1

Running Ubuntu 14.04 (Trusty), I have mounted an exFAT formatted USB drive. While attempting to git clone a repo onto it, I've run into the following error:

Cloning into 'rschedule'...
error: chmod on /media/john/John/apps/rschedule/.git/config.lock 
failed: Function not implemented
fatal: could not set 'core.filemode' to 'false'

Cloning the repo onto my computer's local file system works normally. I can also otherwise access the USB drive normally (i.e. read / create files).

Any ideas as to what may be going wrong?

Additional information which is hopefully irrelevant: Ubuntu is running on a Chromebook using crouton.

Edit:

A possibly related question: How do I use 'chmod' on an NTFS (or FAT32) partition?. Unfortunately, assuming it is related, I haven't been able to figure out how to translate that question / answers to my problem.

John
  • 133
  • Please run sudo chmod a+rwx /path/to/fvat/usb and try again! – George Udosen Dec 12 '18 at 14:34
  • @GeorgeUdosen Thanks! Unfortunately, that command results in the following error: chmod: changing permissions of '/media/john/John': Function not implemented – John Dec 12 '18 at 14:40
  • ok have a look at these: https://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes use the git config core.fileMode false version so it's not globally set – George Udosen Dec 12 '18 at 14:42
  • @GeorgeUdosen the git directory is currently remotely hosted on gitlab. Attempting to run git config outside of a git repository is giving me a fatal: not in a git repository error – John Dec 12 '18 at 14:49
  • @GeorgeUdosen maybe I'm running into the same problem described in the "How to use 'chmod'..." question I linked to? Namely "The mode is determined by the partition's mount options (you cannot change it via chmod)." If so, I'm not sure what mount options I need in order to make things work. – John Dec 12 '18 at 14:49
  • The options would be sudo mount -t vfat -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /mnt/whatever. Ofcourse you will umount it first then remount it sudo umount /dev/sdb1 I presume it's /dev/sdb1!! – George Udosen Dec 12 '18 at 14:55
  • @GeorgeUdosen so I think I made some progress with sudo mount -t exfat -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /mnt/whatever (note: I needed to change vfat format to exfat). This mounts the USB but the mounted folder is owned by the root user (rather than the current user) which messes things up and (I think) forces all commands to be run with sudo. Any idea how I can accomplish this so the mounted folder is owned by the current user? Simply running the mount command without sudo produces a mount: only root can do that error. Thanks!! – John Dec 12 '18 at 15:19
  • Add the umask=000 option to mount command! – George Udosen Dec 12 '18 at 15:25
  • exfat filesystem does not have Unix style file persmission so you cannot chmod on it. – Alvin Liang Dec 12 '18 at 15:29
  • maybe you can run git config --global core.fileMode false and try again. – Alvin Liang Dec 12 '18 at 15:31
  • @AlvinLiang thanks for the help. Unfortunately using git config --global core.fileMode false still results in the same error when attempting to git clone. – John Dec 12 '18 at 15:35
  • @GeorgeUdosen adding the umask=000 to the mount command still results in the root user having ownership permissions of the file. I should also say, for completeness sake, that I've tried to run git clone after each one of these changes and I'm still running into the same error--I'm guessing it's because the USB is mounted with the incorrect permissions. If I inspect the USB's permissions after mounting it normally (i.e. just plugging it in and mounting via the GUI), then it says owner: me & group: john. When mounting using your suggestion, it says owner: root & group: root. – John Dec 12 '18 at 15:40
  • @AlvinLiang it sounds like maybe I simply cannot git clone onto an exfat formatted USB drive? – John Dec 12 '18 at 15:42
  • After some digging, git actually tries to set fileMode to false when it's not applicable. Your problem is actually git can't do some operation on the repository's git config. I don't think one can easily fix this problem without change git code. – Alvin Liang Dec 12 '18 at 15:54
  • a similar problem on other system https://github.com/termux/termux-packages/issues/2441 – Alvin Liang Dec 12 '18 at 15:55
  • 1
    @GeorgeUdosen I think I'm able to get the proper permissions when mounting using sudo mount -t exfat -o rw,auto,user,fmask=0022,dmask=0000,uid=1000,gid=1000 /dev/sda2 /media/john (where 1000 is the user id and group id). Unfortunately, this still doesn't fix the git clone problem (I also tried adding umask=000, no luck). It looks like I was wrong and the How do I use 'chmod' on an NTFS (or FAT32) partition? question is unrelated to this one. Thanks for all your help. – John Dec 12 '18 at 16:01
  • @AlvinLiang thanks for finding that! It does sound like the termux issue you linked to may be related. Unfortunately there doesn't appear to be a solution. – John Dec 12 '18 at 16:07

1 Answers1

0

Assembling from the comments above:

Mounting with

sudo mount -t exfat -o rw,auto,user,fmask=0022,dmask=0000,uid=1000,gid=1000 /dev/sda1 mnt

where mnt is in my home directory thus owned by me and then doing

git -c core.fileMode=false clone ../whatever-bare-repo.git/

seems to work correctly

qwazix
  • 416