Error while pull from git - insufficient permission for adding an object to repository database .git/objects
Assuming @ChrisHayes is right about an accidental sudo, this should fix it. From inside your repository:
sudo chown -R $USER:$USER "$(git rev-parse --show-toplevel)/.git"
Update: for those of you getting the illegal group name
error, try this instead:
sudo chown -R $(id -u):$(id -g) "$(git rev-parse --show-toplevel)/.git"
Go to project's root directory and run below commands to fix this issue,
cd .git/objects
sudo chown -R yourname:yourgroup *
Mine was a stupid mistake... the right username and group were set, but www-data was the account accessing it. The directory was owned by vaindil:www-data, but permissions were 755 so www-data couldn't write to it. Fixed it with:
$ sudo chmod -R 775 /path/to/repo