gitpush

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


When I try to push to a shared git remote, I get the following error: insufficient permission for adding an object to repository database

Then I read about a fix here: Fix This worked for the next push, since all of the files were of the correct group, but the next time someone pushed up a change it made a new item in the objects folder that had their default group as the group. The only thing I can think of is to change all of the developer's default group for items they check in, but that seems like a hack. Any ideas?


Solution

  • Repair Permissions

    After you have identified and fixed the underlying cause (see below), you'll want to repair the permissions:

    cd /path/to/repo/.git
    sudo chgrp -R groupname .
    sudo chmod -R g+rwX .
    sudo find . -type d -exec chmod g+s '{}' +
    

    Note if you want everyone to be able to modify the repository, you don't need the chgrp and you will want to change the chmod to sudo chmod -R a+rwX .

    If you do not fix the underlying cause, the error will keep coming back and you'll have to keep re-running the above commands over and over again.

    Underlying Causes

    The error could be caused by one of the following: