I usb-connect my ios device on my linux laptop. The linux system mounts a gvfs point to it (/run/user/1000/gvfs/afc:host=xxxxxxxxxx,port=3), I change directory there, I can rsync back and forth, but I wish to clone a git repository who lives in my laptop (/home/user/repo.git).

git clone /home/user/repo.git

It will mist-behave:

Cloning into 'repo'...
error: chmod on /run/user/1000/gvfs/afc:host=xxxxxxxxx,port=3/com.lhy.iMarkdown/repo/.git/config.lock failed: Operation not supported
fatal: could not set 'core.filemode' to 'false'

And, sudo git clone /home/user/repo.git will give fatal: could not create work tree dir 'repo': Permission denied.

This explanation by @torek (https://stackoverflow.com/users/1256452/torek) of git clone answering the same situation but for a samba mount point: https://stackoverflow.com/a/50242563

Will say the process fails on the third and last step when git clone uses invokes the OS service to rename the file.

In this case, GVfs mounts a removable foreign operating system that has storage (https://askubuntu.com/a/1035122). This is why sudoing does not work as GVfs makes the mount point usable only by the user who mounted it.

It would be very comfortable to connect my ios device to my linux laptop and use git in it to repositories in my local device/network. Does anyone know how to make this smooth, please? It would be good to leave the configuration in /etc/fstab so that the whole interaction be as natural as any other storage point that I plug and use. Please it does not make sense to rsync things that are on a git repository back and forth and re-create git. People might have worked around such issues using git on restrictive environments/boxes/devices/storages.

1 Answer 1


On Unix, Git expects to be able to run chmod to set the permissions on a file correctly when it's setting the configuration file, as it does when cloning or initializing a repository. In this case, the file system you're trying to use doesn't support that, and that's why this is failing.

The bad news is that no version of Git on Unix will successfully initialize or clone a repository on that file system, since Git doesn't consider chmod to be an optional system call on Unix. You can try cloning the repository on a regular Unix file system and then copying it over and seeing how it works. It may end up working fine, since this problem occurs in some cases on the Windows Subsystem for Linux when working with a Windows drive. It also may not, depending on the functionality that iOS and GVFS expose in this case, and if it doesn't, then you'll have to try a different approach.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .