I had the exact same problem wanting to commit my changes to git, and solved it this way:
-
I needed to change the group of my
.gitfolder and its contents:sudo chown -R <owner>:<group> .git -
needed to change the permission of this folder:
sudo chmod -R 775 .git