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
I resolved it by giving permission to the user on each of the directories that you're using, like so:
sudo chown user /home/user/git
and so on.
Ok, I figured it out. The issue was that I didn't have the correct permissions set for myrepo.git and the parent directory git.
As root I logged into the server and used:
$ chown username /home/username/git
This then returns drwxrwxr-x 4 username root 4096 2012-10-30 15:51 /home/username/git with the following:
$ ls -ld /home/username/git
I then make a new directory for myrepo.git inside git:
$ mkdir myrepo.git
$ ls -ld myrepo.git/
drwxr-xr-x 2 root root 4096 2012-10-30 18:41 myrepo.git/
but it has the user set to root, so I change it to username the same way as before.
$ chown username myrepo.git/
$ ls -ld myrepo.git/
drwxr-xr-x 2 username root 4096 2012-10-30 18:41 myrepo.git/
I then sign out of root and sign into server as username:
Inside git directory:
$ cd myrepo.git/
$ git --bare init
Initialized empty Git repository in /home/username/git/myrepo.git/
On local machine:
$ git remote add origin
ssh://username@server.com/home/username/git/myrepo.git
$ git push origin master
SUCCESS!
Hopefully this comes in handy for anyone else that runs into the same issue in the future!
Resources