Error while pull from git - insufficient permission for adding an object to repository database .git/objects
Solution 1:
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"
Solution 2:
Go to project's root directory and run below commands to fix this issue,
cd .git/objects
sudo chown -R yourname:yourgroup *
Solution 3:
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