Related to Git pull error: unable to create temporary sha1 filename
Hi all. We've had our app in a git project with a bare repo on a different server, for some time now. The bare repo has a post-receive hook which makes it push to our staging server, which in turn has a post-recieve hook to do all the stuff associated with a deploy. It's all been working fine, but now the bare repo is unable to push to the staging server. It's nothing to do with the post-receive process itself, because i get the same error if i ssh onto the bare repo and do a manual push to the staging server from there:
Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.74 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
error: unable to create temporary sha1 filename ./objects/51: No such file or directory
fatal: failed to write object
error: unpack failed: unpacker exited with error code
To ssh://deploy@our-staging-server.com/var/www/apps/e_learning_staging/www
! [remote rejected] develop -> develop (n/a (unpacker error))
error: failed to push some refs to 'ssh://deploy@our-staging-server.com/var/www/apps/e_learning_staging/www'
I can go to the staging server and pull from the bare repo there, and push to it for that matter. So "pull from A to B" works but "push from A to B" doesn't.
I've seen quite a few people having similar problems and have investigated the following issues:
1) different users: not an issue as the push is done to the deploy user, which is the only user anyone uses on the staging server.
2) file permissions: i've recursively chowned all files in .git to deploy:deploy (the user and group we use) and have recursively chmodded u+w,g+w onto all the files in .git
3) git-fsck,git-gc. I've done these on the repo and on the staging server.
4) new-file permissions: doing 'umask' on the staging server gives 0022, which is equivalent to u=rwx,g=rx,o=rx
so that should be fine. Just in case i changed it to 0002, which now lets the group do anything as well as the user do anything, made no difference.
5) Setting sharedRepository=true in .git/config, on the staging server. I did this thinking that maybe it was necessary in order to push to it from the bare repo. Didn't make any difference (it was never set before when it all worked, anyway), so i took it out again.
6) git-repack: I tried a repack but was told there was nothing to pack.
7) Did git reset --hard
on the staging server. Didn't help.
8) Haven't run out of disk space.
I feel like i've researched this and tried everything, it's doing me in. Can anyone suggest anything else i could try?
EDIT - i tried cloning the repo into a new folder on the staging server, and changing the bare repo's git config to point to that new folder in the definition for the "staging_server" remote. I then pushed to the bare repo from my local machine, and then tried to push from the repo to the staging server, and got the same problem:
error: unable to create temporary sha1 filename ./objects/26: No such file or directory
There is no objects/26 folder in the .git folder on the staging server, but i don't know why it's failing to make one.