Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git error “unable to write sha1 filename … Permission denied”

Tags:

git

I am using git on windows. This is what I did: doing development on machine M1, created bare repository on USB drive M2 to backup the repository on M1. I did backups using this command (from git bash on M1):

git push --mirror "f:\repo"

Worked without any issues. Then I bought a new machine M3. I cloned the repository from M2 to M3:

git clone "f:\repo" .

Made some checkins to the repo in M3. Then I did (from git bash on machine M3)

git push --mirror "f:\repo"  

I get this error: unable to write sha1 filename … Permission denied How can I fix this?

like image 314
morpheus Avatar asked Jul 01 '11 17:07

morpheus


3 Answers

Bit late but none of these worked for me. I had to run sudo git gc in the remote repository and that somehow fixed all my problems.

After that I pushed again and it worked

like image 130
A_toaster Avatar answered Nov 19 '22 23:11

A_toaster


Even if it is about a different context (git+ssh), check the ACL associated with your repo.
See for instance this blog post.

As suggested in the SO question "Git pull error: unable to create temporary sha1 filename" (which has other interesting suggestions as well), try redoing your bare repo, this time with the config:

git config core.sharedRepository true
like image 35
VonC Avatar answered Nov 19 '22 23:11

VonC


Ran into this error because of permissions on distant respository. In my case it was the ssh user which was the wrong one for rights.

like image 1
Pipo Avatar answered Nov 19 '22 23:11

Pipo