Saturday, March 12, 2016

linux - Git fatal: unable to write new_index file

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?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...