# Problem:
# error: insufficient permission for adding an object to repository database .git/objects
# fatal: failed to write object
# fatal: unpack-objects failed
cd /path/to/repo.git
sudo chgrp -R ubuntu . # Here ubuntu is the group name of the user you want to give access
sudo chmod -R g+rwX .
sudo find . -type d -exec chmod g+s '{}' +