Error below occurred when trying to commit staged files so follow the steps below to solve the problem.


error: insufficient permission for adding an object to repository database .git/objects
error: Error building trees

Update permissions on git repository


Make sure your "group" can write to shared group repository.


inanzzz@inanzzz:~$ sudo find -iname '.git'
./.git
inanzzz@inanzzz:~$ cd ./.git
inanzzz@inanzzz:/.git$ sudo chgrp -R inanzzz .
inanzzz@inanzzz:/.git$ sudo chmod -R g+rwX .
inanzzz@inanzzz:/.git$ sudo find . -type d -exec chmod g+s '{}' +

or


inanzzz@inanzzz:~$ sudo find -iname '.git'
./.git
inanzzz@inanzzz:~$ cd ./.git
inanzzz@inanzzz:/.git$ sudo chgrp -R inanzzz *
inanzzz@inanzzz:/.git$ sudo chmod -R g+wX *
inanzzz@inanzzz:/.git$ git repo-config core.sharedRepository true