git insufficient permission for adding an object to repository database ./objects

strangely, I had been pushing to this repository for weeks no problems. Then one day I get the error message for the title above:


$git push
Counting objects: 9, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 506 bytes, done.
Total 5 (delta 2), reused 0 (delta 0)
error: insufficient permission for adding an object to repository database ./objects
fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit

I was a member of the group in question, checked via:

$ groups myusername

and verified that group had write permissions:

$ ls -la

Turned out a few files had shown up in the object directory with different permissions.

To fix:

ssh to server
cd your-repository.git

sudo chmod -R g+ws *
sudo chgrp -R yourgroup *

and maybe:

git repo-config core.sharedRepository true

and then try to push again

3 thoughts on “git insufficient permission for adding an object to repository database ./objects”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: