1

I'm trying to clone a git repo on a Windows mapped network drive under WSL (Windows Subsystem for Linux). The drive is a Samba share.

Windows version: 10.0.19044 WSL: Ubuntu 20.04LTS

fstab: V: /mnt/v drvfs rw,relatime,user,umask=000 0 0

$ sudo git clone https://github.com/google/googletest.git ./xxx
Cloning into './xxx'...
error: unable to mmap '/mnt/v/xxx/.git/config': Operation not permitted
fatal: could not set 'core.filemode' to 'false'

Permissions of /mnt/v/:

$ ls -la /mnt/v/
total 38912
drwxrwxrwx 1 root root      512 Feb  7 12:06  .

I have also tried:

sudo mount -t drvfs '\\samba\my-drive' /mnt/Vtest/

$ git clone https://github.com/google/googletest.git ./xxx
Cloning into './xxx'...
error: chmod on /mnt/Vtest/xxx/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'

Permissions of /mnt/Vtest:

$ ls -la .
total 38912
drwxrwxrwx 1 root root      512 Feb  7 12:06  .

And also tried:

sudo mount -t drvfs V: /mnt/Vtest/ -o metadata

$ git clone https://github.com/google/googletest.git .
Cloning into '.'...
error: chmod on /mnt/Vtest/delete/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'

Using sudo goes a bit further, but still fail:

$ sudo git clone https://github.com/google/googletest.git .
Cloning into '.'...
remote: Enumerating objects: 23828, done.
remote: Counting objects: 100% (286/286), done.
remote: Compressing objects: 100% (168/168), done.
fatal: Unable to create temporary file '/mnt/Vtest/delete/.git/objects/pack/tmp_pack_XXXXXX': Permission denied
fatal: index-pack failed

I have seen: Git init: fatal: could not set 'core.filemode' to 'false' and checked that no AV is scanning this directory.

JPh
  • 536
  • 3
  • 20
  • Have you tried running the command prompt with Admin permission? – TDiblik Feb 08 '22 at 09:58
  • Just tried, made no difference. – JPh Feb 08 '22 at 10:21
  • Using a Git repository on a network drive is not a good idea in general. You should store it on a local filesystem. – j6t Feb 08 '22 at 10:48
  • Why? I need to access the files from two machinnes: this one and a Linux build server. The share is on a Samba server and I'd rather mount the NTFS filesystem, but WSL does not support CIFS. – JPh Feb 08 '22 at 12:26

1 Answers1

1

The solution I found was to upgrade to WSL2 and mount using cifs instead of drvfs:

sudo mount -t cifs -overs=3.0,mfsymlinks,username=xxxxx,uid=1000 '\\samba\xxxxx' /mnt/v

As an aside, I am building a CMake project targetting WSL-GCC. I had issues with the CMake tools failing due to permissions errors and trying to delete apps that were still running (resource busy). I solved this by moving the CMake build files to the C: drive of the local machine under WSL, by setting 'Build root to C:....'. This also has the benefit of speeding up the build.

JPh
  • 536
  • 3
  • 20