WSL Git Clone Linked Folder Error

“Config Lock Failed Operation not Permitted” – Git

When attempting to clone a git repository on a linked folder within Windows Subsystem for Linux (WSL), I encountered the following error message:

Cloning into 'pw-iam'...
error: chmod on /mnt/c/projects/pw-iam/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'
WSL Git Clone Linked Folder Error

This error occurs when cloning repos to a mounted Windows drive in WSL. I am not sure of the fix for this issue, but if anyone has a solution, please let me know. Otherwise, this post serves as a note-to-self for me to try and figure out the solution in the future.

Comments

2 responses to ““Config Lock Failed Operation not Permitted” – Git”

  1. […] to a ‘projects’ folder in this post but I get an error when cloning git repos in them (chmod error). Using mounted Windows drives for version-controlled projects is appearing to be a no […]

  2. William Gillett Avatar

    I would not attempt to use a windows file store for critical WSL2 files. As far as I know, there is no way to preserve the permissions needed by Linux in a windows file structure. A WSL projects folder connected to remote repos – is the best backup of that data. The whole instance of the distro can be backed up in a tar file that would preserve the file structures in the event you need to rebuild.
    https://www.windowscentral.com/how-backup-windows-subsystem-linux-wsl-distribution

Leave a Reply

Your email address will not be published. Required fields are marked *