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 » Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory
  • Webp.net resizeimage 2
    Add or Remove Network Interface from a VM in Azure AWS/Azure/OpenShift
  • MAP virtual disk error
    Install Workstation Pro 17: Fix failed to initialise library for mounting and unmounting virtual disks Virtualization
  • SASS in VsCode
    How to Install SASS on VsCode Scripts
  • 1 kAUgwdVYmcVgUSXiwUkObw
    Error 0x801c001d – Automatic registration failed: Failed to look up the registration service from AD Windows Server
  • veeamONE integration with VBR
    Install Veeam ONE and Add VBR: Fix failed to connect to VBR Backup
  • https   specials images.forbesimg.com imageserve 4c098735a05b4251a85e8505c91f1837 0x0
    Fix insufficient access rights to perform this operation when trying to enable Active Directory Recycle Bin Windows Server
  • windows update 03
    Check if Windows Updates were installed via the Registry Editor Windows
  • Fix Secure Boot certificate expiration
    Enable Secure Boot: Fix Secure Boot certificates expiration [Part 1] Windows

Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory

Posted on 08/02/202221/12/2023 Christian By Christian No Comments on Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory
Error: cannot lock ref 'refs/remotes/origin/windows': unable to resolve reference 'refs/remotes/origin/windows', Not a directory

In this article, we shall discuss how to fix the Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory. Kindly refer to these related guides: How to install, register and start GitLab Runner on Windows, Panic: Failed to register the GitLab-runner, you may be having network issues, 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.

GitLab’s application offers functionality to collaboratively plan, build, secure, and deploy software as a complete DevOps Platform. You can host GitLab on-premises or on cloud storage since it offers high scalability. It also includes a wiki, issue-tracking, IDE, and CI/CD pipeline features.

After you install the application, you register individual runners. Registering a runner establishes communication between your GitLab instance and the machine with GitLab Runner installed. Runners usually process jobs on the same machine where you installed GitLab Runner.

GitLab Runner implements a few shell script generators that allow executing builds on different systems.

What causes the Issue?

The following error “unable to resolve reference” as seen below was because, in the config.toml file, a shell executor was specified in the config.toml file and this does not work well in Windows 10.

'unable to resolve reference' error when locking ref 'origin/windows'. 'Not a directory'

Below is the config.toml that caused the issue. The PowerShell script executes all commands within the PowerShell Core context. In GitLab Runner 14.0 and later, this is the default when registering a new runner.

This is why we had it in the file. This is not the complete config.toml file, this is just to show you what was wrong 🙂

concurrent = 1
check_interval = 0
[session_server]
  session_timeout = 1800
[[runners]]
  name = "docker-windows executor"
  url = "https://techdirectarchive.com"
  token = "xxxxxxxxxxxxxx"
  executor = "docker-windows"
    shell = "pwsh" -------------------------------------> This was the reason for the error
  [runners.custom_build_dir]

Kindly refer to this similar guide: Error, cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve ‘refs/remotes/origin/windows’: not a directory.

Resolving the Issue “Error: cannot lock ref ‘refs/remotes/origin/windows”

To resolve this issue, ensure the config.toml file is edited with notepad++ which is one of my preferred editors.

To do this, ensure notepad++ is installed on your device and then right-click on the config.toml file and select Notepad++. It should look like this below if you are running the docker-window executor without having to specify the shell = "pwsh".

concurrent = 1
check_interval = 0
[session_server]
  session_timeout = 1800
[[runners]]
  name = "docker-windows executor"
  url = "https://techdirectarchive.com"
  token = "xxxxxxxxxxxxxx"
  executor = "docker-windows"
  [runners.custom_build_dir]

Now that you have modified the config.toml file, you will have to restart the GitLab-runner service and the Docker-Desktop service and proceed to run the job again.

If everything is fine, the job will run and status showing the job has succeeded.

Running with gitlab-runner 14.7.0 (xxxx)
  on Windows runner with docker-windows executor XXXXXXXX
Preparing the "docker-windows" executor
00:01
Using Docker executor with image mcr.microsoft.com/windows:xxxx ...
Pulling docker image mcr.microsoft.com/windows:xxxx ...
Using docker image xxxxxx for mcr.microsoft.com/windows:xxxx with digest mcr.microsoft.com/windows@xxxxxxx ...
Preparing environment
00:04
Running on RUNNER-XXXXXXXXX via 
device-Niemand...
Getting source from Git repository
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in ----
.
.
.
$ dir
    Directory: C:-------------
Mode                 LastWriteTime         Length Name                         
----                 -------------         ------ ----                         
-a----          2/6/20XX   1:57 PM            182 .gitlab-ci.yml               
$ echo %PATH%
%PATH%
Cleaning up project directory and file based variables
00:04
Job succeeded

Note: Since pwsh entry for the shell attribute in GitLab-runner config.toml does not work in Windows 10 devices correctly, instead of taking the shell = "pwsh" off, you can simply replace the “pwsh” with “PowerShell” and this would work as well. Therefore edit the confg.toml as discussed below.

  concurrent = 1
check_interval = 0
[session_server]
  session_timeout = 1800
[[runners]]
  name = "docker-windows executor"
  url = "https://techdirectarchive.com"
  token = "xxxxxxxxxxxxxx"
  executor = "docker-windows"
    shell = "powershell" -------------------------------------> This will also have the issue resolved
  [runners.custom_build_dir]

And then restarting GitLab-runner and the Docker-Desktop services will have this issue fixed.

gitlab-runner.exe restart

Refer to these similar errors: Install Git on Windows: The term “git” was not used as the name of a cmdlet, function, script file, or executable Program recognized, how to resolve “Failed to remove network for build: Error during connect in the default daemon configuration on Windows, the Docker client must be run with elevated privileges“, and how to resolve “failed to remove network for the build, Job failed error: Invalid volume specification: “/cache”.

I hope you found this blog post on how to fix “Error: cannot lock ref ‘refs/remotes/origin/windows’: unable to resolve reference ‘refs/remotes/origin/windows’, Not a directory” helpful. If you have any questions, please let me know in the comment session.

Rate this post

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

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • Share on Nextdoor (Opens in new window) Nextdoor
Version Control System Tags:Git, GitLab, GitLab-Runner

Post navigation

Previous Post: Microsoft BitLocker Administration and Monitoring Report Fields
Next Post: Error 1385: The user has not been granted the requested logon type at this time

Related Posts

  • connect GitHub and Build a CI:CD Pipeline with Vercel
    How to connect GitHub and Build a CI/CD Pipeline with Vercel Version Control System
  • gitlabcomplete
    Install Docker Desktop and register GitLab-Runner with Docker-windows executor Containers
  • Slide2
    How to Setup Jenkins Pipelines Environment for Docker Container Deployment Containers
  • Screenshot 2022 04 02 at 22.59.54
    How to fix importing the project failed: Project namespace path can contain only letters, digits, etc Version Control System
  • GitVulfix456zgfbn
    Git Vulnerability: Git for Windows uninstaller is vulnerable to DLL hijacking when run under the SYSTEM user account Version Control System
  • Screenshot 2022 03 20 at 20.37.16
    Setup HTTPS users using Git credentials and Pushing Code to AWS CodeCommit AWS/Azure/OpenShift

More Related Articles

connect GitHub and Build a CI:CD Pipeline with Vercel How to connect GitHub and Build a CI/CD Pipeline with Vercel Version Control System
gitlabcomplete Install Docker Desktop and register GitLab-Runner with Docker-windows executor Containers
Slide2 How to Setup Jenkins Pipelines Environment for Docker Container Deployment Containers
Screenshot 2022 04 02 at 22.59.54 How to fix importing the project failed: Project namespace path can contain only letters, digits, etc Version Control System
GitVulfix456zgfbn Git Vulnerability: Git for Windows uninstaller is vulnerable to DLL hijacking when run under the SYSTEM user account Version Control System
Screenshot 2022 03 20 at 20.37.16 Setup HTTPS users using Git credentials and Pushing Code to AWS CodeCommit AWS/Azure/OpenShift

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

  • Webp.net resizeimage 2
    Add or Remove Network Interface from a VM in Azure AWS/Azure/OpenShift
  • MAP virtual disk error
    Install Workstation Pro 17: Fix failed to initialise library for mounting and unmounting virtual disks Virtualization
  • SASS in VsCode
    How to Install SASS on VsCode Scripts
  • 1 kAUgwdVYmcVgUSXiwUkObw
    Error 0x801c001d – Automatic registration failed: Failed to look up the registration service from AD Windows Server
  • veeamONE integration with VBR
    Install Veeam ONE and Add VBR: Fix failed to connect to VBR Backup
  • https   specials images.forbesimg.com imageserve 4c098735a05b4251a85e8505c91f1837 0x0
    Fix insufficient access rights to perform this operation when trying to enable Active Directory Recycle Bin Windows Server
  • windows update 03
    Check if Windows Updates were installed via the Registry Editor Windows
  • Fix Secure Boot certificate expiration
    Enable Secure Boot: Fix Secure Boot certificates expiration [Part 1] Windows

Subscribe to Blog via Email

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

Join 1,825 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

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.