Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » Version Control System » Git config –global init.defaultBranch: Error cannot lock ref ‘refs/remotes/origin/windows’, not a directory
  • proxmox
    Clone a Proxmox Container: CT Restoration Guide Virtualization
  • squid proxy feature
    How to Set Up and Configure a Squid Proxy Server Linux
  • WCD
    Join Bulk Devices using a Provisioning Package to Azure AWS/Azure/OpenShift
  • dfggg
    SimpleSAMLphp Setup on Windows Server [Part 1] Windows Server
  • S3 Bucket Replication
    Set up Cross-Region Replication for S3 Buckets AWS/Azure/OpenShift
  • Windows10
    Configure new GPO settings and Security baseline for Windows Windows
  • Screenshot 2020 06 22 at 22.46.00
    How to use a dedicated MsSQL Db for Pleasant Password Oracle/MSSQL/MySQL
  • FEATURE ZABBIX
    How to Install Zabbix Monitoring Tool on a Linux System Linux

Git config –global init.defaultBranch: Error cannot lock ref ‘refs/remotes/origin/windows’, not a directory

Posted on 16/10/202121/12/2023 Christian By Christian No Comments on Git config –global init.defaultBranch: Error cannot lock ref ‘refs/remotes/origin/windows’, not a directory
git-default-branch-min

This article provides you with the steps to fix Git config –global init.defaultBranch: Error cannot lock ref ‘refs/remotes/origin/windows’, not a directory. A branch in Git is simply a lightweight movable pointer to one of the commits. Please see how to clone a repository and install software from GitHub on Windows, how to install and uninstall Docker Desktop on Windows 10 and Windows Server, and how to install Git on macOS. The default branch name in Git is master. As you start making commits, you’re given a master branch pointing to your last commit.

Every time you commit, the master branch pointer moves forward automatically. The “master” branch in Git is not a special branch.

It is exactly like any other branch. Nearly every repository has one because the git init command creates it by default. And most people don’t bother to change it.

If you wish to changes the defautlt branch, here are the steps in renaming the default branch. These steps will be discussed in details in a different guide;
- Change the branch name
- Set remote upstream tracking for the new branch
- Change the new branch name in repo host.

Encounter the following issue while executing a Git pipeline job. In this context, the error emerged as I used “master” instead of “main,” highlighting the significance of comprehending Git branches, including the default master branch in Git.

You can see from the image below that various hinds were given. With these hints, I was able to resolve the issue very quickly.

err2Capture

Furthermore, Kindly refer to these related guides: How to install, register and start GitLab Runner on Windows, and Panic: Failed to register the GitLab-runner, you may be having network issues,

Solution to fixing Error cannot lock ref ‘refs/remotes/origin

This error can be resolved in different ways but understanding your environment will help.

In my case, I had to set git config --global init.defaultBranch main as suggested in “line 18” in the image above. The default branch’s name is main, not master.

git config --global init.defaultBranch main

Upon comprehending Git branches and the default master branch in Git. The problem was resolved by altering the git init default branch name, as indicated earlier. Should you continue encountering these errors even after correctly specifying the branch name, kindly proceed with the following steps.

Kindly refer to this error: Cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory!

Other Solutions

If you’re familiar with Understanding Git Branches and the Default Master Branch in Git, and the branch name is accurate, it’s essential to prune the origin. You can eliminate references to remote branches within the directory by doing so. git/refs/remotes/origin. 

This will not affect your local branches, and it will not change anything remotely, but it will update the local references you have to remote branches.

git remote prune origin

If these solutions prove ineffective, explore additional steps at the provided link. Your understanding of Git branches and the default master branch in Git is crucial.

I hope you fund this guide useful on Git config –global init.defaultBranch: Error cannot lock ref ‘refs/remotes/origin/windows’, not a directory. Feel free to leave a comment below. Your feedback is greatly valued.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Version Control System Tags:Git, Git GUI, Git OSX, GitLab, GitLab-Runner, Microsoft Windows, Windows 10, Windows Server 2016

Post navigation

Previous Post: How to delegate permissions for backing up TPM password
Next Post: How to uninstall GitLab Runner from your Windows device

Related Posts

  • Angular Azure
    How to deploy your Angular App to Azure from Visual Studio Code AWS/Azure/OpenShift
  • banner 1
    Deploying Next.Js App Using Heroku Cloud Application Platform Version Control System
  • gitlabcomplete
    Install Docker Desktop and register GitLab-Runner with Docker-windows executor Containers
  • Fatal Refusing to Merge
    How to Fix Fatal Git Error Refusing to Merge Unrelated Histories Version Control System
  • mgithub
    How to use Command-Line on Git Bash and GitHub Desktop to PUSH local code to GitHub Version Control System
  • Error during connect in the default daemon configuration on Windows
    Preparation failed: The docker client must be run with elevated privileges Version Control System

More Related Articles

Angular Azure How to deploy your Angular App to Azure from Visual Studio Code AWS/Azure/OpenShift
banner 1 Deploying Next.Js App Using Heroku Cloud Application Platform Version Control System
gitlabcomplete Install Docker Desktop and register GitLab-Runner with Docker-windows executor Containers
Fatal Refusing to Merge How to Fix Fatal Git Error Refusing to Merge Unrelated Histories Version Control System
mgithub How to use Command-Line on Git Bash and GitHub Desktop to PUSH local code to GitHub Version Control System
Error during connect in the default daemon configuration on Windows Preparation failed: The docker client must be run with elevated privileges Version Control System

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • proxmox
    Clone a Proxmox Container: CT Restoration Guide Virtualization
  • squid proxy feature
    How to Set Up and Configure a Squid Proxy Server Linux
  • WCD
    Join Bulk Devices using a Provisioning Package to Azure AWS/Azure/OpenShift
  • dfggg
    SimpleSAMLphp Setup on Windows Server [Part 1] Windows Server
  • S3 Bucket Replication
    Set up Cross-Region Replication for S3 Buckets AWS/Azure/OpenShift
  • Windows10
    Configure new GPO settings and Security baseline for Windows Windows
  • Screenshot 2020 06 22 at 22.46.00
    How to use a dedicated MsSQL Db for Pleasant Password Oracle/MSSQL/MySQL
  • FEATURE ZABBIX
    How to Install Zabbix Monitoring Tool on a Linux System Linux

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,836 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

Active Directory AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.