Insufficient permission for adding an object to repository database .git/objects

Not sure how it happened unfortuantly so I cannot replicate it but found some information on the web but the way I resolved it was.

Fix 1

ssh yourusername@servername
//Make sure you are in the root of your directory and go into .git
cd .git
sudo chmod -R g+ws *
//Find your group name by using the groups command
//change my-group with your desired group name
sudo chgrp -R my-group *
git config core.sharedRepository true

Fix 2

This then bought me back the error:
unable to unlink old [filename] (Permission denied)
To fix this I ran this over all the files in that folder
sudo chmod -R g+w views/