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?
Best Answer
Sounds like you're actually sharing the same working repo across multiple users, which is in general not a good idea:
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):
git clone
/git pull
from this bare repo into their own local working repos where they makegit commit
their changes and thengit push
them back into the shared repogit pull
in this one would 'refresh' the content with all commits pushed in the bare repo since the lastgit pull
(a httpd restart may be needed as well after that)