We are a web development company that is transitioning to Git.

Eventually we intend to run it fully locally but at the moment we have development websites hosted on a Linux server, which is also where the Git repos are (which I create via Tower on my own machine).

Our developers connect to this server via either AFP (Mac) or Samba (Windows / Linux) and use a combination of Tower and Sourcetree to check in these changes.

Our web development folder on this server is shared and permissioned so that all read / writes are done as the www-data user. Not ideal by any means and not something I'd do in production but it works for us. Mostly....

Every so often when attempting to stage modified files or commit them, this error message is received:

fatal: unable to write new_index file

Sometimes it's just "index", with no "new_" prefix.

I have found that SSHing to the server as the www-data user, cd'ing to the .git folder within the project, and then renaming index to something else and back again often fixes this problem. The permissions (660) are correct on the file before and after this, but the rename trick seems to work.

Apart from the obvious long term goal of having Git / websites running on the developer's own machines, is there a solution to this - or is it simply that managing a Git repo remotely isn't recommended?


Sounds like you're actually sharing the same working repo across multiple users, which is in general not a good idea:

  • you're opening up to conflicts in the repo control - the errors could very well indicate such conflict, the file renaming would simply mask it but I guess changeset loss or even serious corruptions may happen especially if different machines use different versions of git
  • you're losing the identity of the author in the repo history

I'd suggest creating a group-shared bare git repo (specifically designed for sharing) on that very same partition, accessible to the developer machines in the same way as the current repo (plenty of info out there, you could start at https://stackoverflow.com/questions/7632454/how-do-you-use-git-bare-init-repository):

  • developers would git clone/git pull from this bare repo into their own local working repos where they make git commit their changes and then git push them back into the shared repo
  • another repo would be pulled by www-data from the bare repo on the linux server for serving the development websites; a git pull in this one would 'refresh' the content with all commits pushed in the bare repo since the last git pull (a httpd restart may be needed as well after that)

I know this is old, but I still experience this same problem. It doesn't work over AFP. Instead, connect to the share on SMB and it'll work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.