Due to a new job, I'm switching from working on Ubuntu 14.04 to OSX Yosemite.

I mainly work in R, and I was using RStudio and git to manage my code on a server (Debian). To this I mounted the server using sshfs and simply used it as if it was a local volume, which worked flawlessly.

I tried to to this in OSX, but instead mounting it via osxfuse+sshfs. However, git does not work correctly when running on the OSXFUSE volume, giving the following mistake when I try to commit changes:

fatal: Unable to create '/Users/maltethodberg/server/home/nzl922/rstudio_projects/mactest2/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

I can create and manage git projects using Rstudio created locally on my machine just fine, however.

Is there some trick for making git play nicely with sshfs on OSX that I'm unaware of? At this point I'm unsure whether is a problem on the server or my local machine.

Any help is greatly appreciated!

1 Answer 1


There is probably a index.lock file in the .git folder that is causing this error message. The error is shown whenever a change is made by one user and the lock is owned by another user. This will protect the local git tree from commits by different users interfering with eachother.

You may wonder why the lock is not owned by your user on the remote system, since that account is owned by you. This is probably due to the fact that osxfuse and sshfs are not giving you the correct permissions. What happens is that the remote system tries to match your local user and group ids with the ones on the remote system. This might be what is causing the problem. You can try to let sshfs obtain the correct permissions on the remote system instead.

From this post I quote:

If you call sshfs from command line just add -o defer_permissions. If you use Macfusion put -o defer_permissions in "SSH Advanced > Extra Options".


You must log in to answer this question.

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