I have been having trouble with this error message and I don\'t understand the proper solution to fix it or go about debugging it. I have googled the error in various forms
It sounds like you have file in the git repo owned by root. Since you're ssh'ing in as 'username' to do the push, the files must be writable by username. The easiest thing is probably to create the repo as the user, and use the same user to do your pushes. Another option is to create a group, make everything writable by the group, and make your user a member of that group.
Just try to do this one (through root access) - "chmod -R 777 /home/username/git"
It would seem like your user doesn't have permission to write to that directory on the server. Please make sure that the permissions are correct. The user will need write permissions on that directory.
A possibility is that the git server you are pushing to is down/crashed, and the solution lies in restarting the git server.
Thanks to Don Branson,I solve my problem.I think next time i should use this code when i build my repo on server:
root@localhost:~#mkdir foldername
root@localhost:~#cd foldername
root@localhost:~#git init --bare
root@localhost:~#cd ../
root@localhost:~#chown -R usergroup:username foldername
And on client,i user this
$ git remote add origin git@servername:/var/git/foldername
$ git push origin master
One of the principal issues with pushing to a GIT is that the material you push will appear as your material, and will block submissions from other people on a team. As a GIT repository administrator, you will have to manage the hooks to prevent Alice's push from blocking Bob from pushing. To do that, you will want to ensure that your developers all belong to a group, lets call it 'developers' and that the repository is owned by root:developers, and then add this to the hooks/post-update script:
sudo chown -R root:developers $GIT_DIR
sudo chmod -R g+w $GIT_DIR
That will make it so that team members are able to push to the repository without stepping on each other's toes.