I have an existing project, deployed to heroku and under git control. I've been regularly adding and committing code.
I recently rebuilt the computer I'm working on (OSX, 10.6) and now when I invoke
git status
I see my changes, but when I try to add the changed files for committing, I get
Dans-iMac-335:[app-name-obscured] apple$ git add public/javascripts/*
fatal: Unable to write new index file
I've cloned the project from the heroku git repository, and I can add there. The ownership of the files in the two projects is the same. What could be causing this? My option is to add each of the changed files to the newly cloned version and reconstruct it that way, but there are a lot of changes, and it seems likely there's a fix here.
Anyone experienced this, and any ideas where to start?
Chris : thanks for the exhaustive reply.
I can run git using sudo. It seems in that sense to be a permissions issue, although the directory is 755, and owned by me, and the enclosed files 644, again owned by me (same user as owns the project files). There's lots of disk space, and the suggestion that directory is writable is a good one, but I was running git from inside the directory that contains the project - would it still need to create the path then?
I don't find ktrace on my system, and I'm not a real expert on terminal manipulations, but I tried running dtruss. That showed no problems, but it occurred to me that because I had to use sudo to run dtruss, it meant that the process dtruss was monitoring was also running as superuser. In any case, at that point it was able to add the items to git, and also using sudo I was able to commit them just now. The problem is when adding a new item, as opposed to a modified one. If I had done something like
sudo dtruss su <my_username> git add some/file/name/*
would I have been able to run git as my regular name? I thought of this after I hacked my way to getting the desired result.
I can live with using sudo for operations where items are added and committed for now. What I want to do is get my heroku repo inline with the current work: then I figure I can clone that, and see if the problem goes away. Otherwise, I'll be back…
.git
directory in the root of your project?ktrace
provided on older systems, but I do not have a 10.5 or 10.6 system to figure out the options you would need to get the information from dtrace. Running as root will hide many kinds of permission problems (permission checks are often completely skipped for processes running as root). You say “the directory is 755”; are you talking about the.git
directory or the top level of the working tree (the directory that contains the.git
directory)? Did you check for flags withls -lo .git/index
?o
toO
(uppercase letter oh) in 10.5 and later. So check it withls -lO .git/index
.