Question

There are a couple good posts on this subject, but I am not sure if they apply to my circumstances.

Error pushing to GitHub - insufficient permission for adding an object to repository database

Git Push Error: insufficient permission for adding an object to repository database

When performing a push as a normal user, I receive the following error:

remote: error: insufficient permission for adding an object to
    repository database ./objects

Note that I can push if I am logged on the local machine as root. I see from the below that the origin is git@easybbb.com:root I don't know if it matters, but the remote repository I am trying to push to is hosted by me using GitLab.

The local git directory is 0775 and belongs to group "www", I've executed chmod -R g+rwxs /var/www/ to ensure that new files are of group "www", the normal user that is trying to push belongs to group "www", and I've executed git config core.sharedRepository group.

How do I fix this error?

git push origin master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 487 bytes | 0 bytes/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To git@easybbb.com:root/bidjunction.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'git@easybbb.com:root/bidjunction.git'

git remote -v
origin  git@easybbb.com:root/bidjunction.git (fetch)
origin  git@easybbb.com:root/bidjunction.git (push)
Was it helpful?

Solution

It has nothing to do regarding the many similar questions. The key is "remote: error: ". The problem is the remote repository (GitLab which is similar to GitHub). Making all associated files owned by git solved the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top