I'm trying to get Git working on my System, but I always get the error
error: insufficient permission for adding an object to repository database ....../.git/objects
I'm working on a Surface Pro 5 in Windows Subsystem for Linux with Ubuntu.
Everything is working fine if I'm working on the internal drive.
The problem starts when I want to work on my micro SD Card.
First it wasn't mounted automatically.
I fixed that by editing the /etc/fstab
file:
E: /mnt/e drvfs defaults,metadata,rw,exec,uid=nico,gid=nico 0 0
and ls -alR
shows that permissions should be rw for all users and all files.
I tried git add
on an existing repository on this SD Card and it didn't work.
Somehow it created a tmp file in '.git/objects/54/' which had no write permissions every time I tried it.
Then I tried to clone a Test Repository but it created the folder for a splitsec and gave me the same error. It is working though on my normal drive C: but not on my SD Card.
nico@DESKTOP-639MEJ9:/mnt/e$ git clone https://github.com/NicoJG/TestGit.git
Cloning into 'TestGit'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
error: insufficient permission for adding an object to repository database /mnt/e/TestGit/.git/objects
fatal: failed to write object
fatal: unpack-objects failed
nico@DESKTOP-639MEJ9:/mnt/e$ sudo git clone https://github.com/NicoJG/TestGit.git
[sudo] password for nico:
Cloning into 'TestGit'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
error: insufficient permission for adding an object to repository database /mnt/e/TestGit/.git/objects
fatal: failed to write object
fatal: unpack-objects failed
nico@DESKTOP-639MEJ9:/mnt/e$
Somehow git isn't working properly with the permissions in the WSL. I already tried:
sudo chmod -R ug+rw *
sudo chwn -R nico:nico *
Has anyone any idea how to fix it?
Edit: As requested from bk2204 here is the output of mount
:
nico@DESKTOP-639MEJ9:/mnt/e$ mount
rootfs on / type lxfs (rw,noatime)
none on /dev type tmpfs (rw,noatime,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,noatime,gid=5,mode=620)
none on /run type tmpfs (rw,nosuid,noexec,noatime,mode=755)
none on /run/lock type tmpfs (rw,nosuid,nodev,noexec,noatime)
none on /run/shm type tmpfs (rw,nosuid,nodev,noatime)
none on /run/user type tmpfs (rw,nosuid,nodev,noexec,noatime,mode=755)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
cgroup on /sys/fs/cgroup type tmpfs (rw,relatime,mode=755)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,relatime,devices)
E: on /mnt/e type drvfs (rw,relatime,uid=1000,gid=1000,case=off)
C:\ on /windir/c type drvfs (rw,noatime,uid=1000,gid=1000,umask=22,fmask=11,metadata,case=off)
I only know what C: (my main drive) and E: (my SD Card) are. The rest seems to be WSL specific I think.