# error: insufficient permission for adding an object to repository database .git/objects
# EASIEST & SIMPLEST SOLUTION ↓
sudo chmod 777 -R /path/to/your/git/repository/.git/objects
cd into .git/objects
run sudo chown -R "${USER:-$(id -un)}" .
find .git/ -exec stat --format="%G %n" {} + |grep root
chown -R $(id -un):$(id -gn) .git/objects/
git commit -a -m "fixed git objects ownership"
sudo chown -R www-data .
cd .git/objects
ls -al
sudo chown -R yourname:yourgroup *