0

I'm trying to setup git for the first time.

I have a VPS from Linode running Ubuntu 12.04, and my own desktop on Windows 7. I am using Git Bash on my desktop.

On my local windows machine I created a directory, used git init, added a test file, and committed it.

On the linux server, I installed git, then created the directory

/srv/git/site.git

I then used the command

/srv/git/site.git git init --bare.

Finally, back on the local windows machine, I use

git remote add mysite ssh://root@11.123.123.123/srv/git/site.git

(IP changed for security reasons).

all is well up until this point.

I finally try to push by using

git push -u mysite +master:refs/heads/master.

This command gives me the error

fatal: 'root@11.123.123.123/srv/git/site.git' does not appear to be a git repository  
fatal: Could not read from remote repository`

I've checked the IP and user name used for my SSH login, and they are right. In fact, just using PuTTY I can login using the same root@IP address.

I'm banging my head against the wall here. I would really appreciate it if someone could provide tips for debugging this. Is there a connection log where I can see the actual 'ssh' command Git Bash is executing?

Is the problem that it can't connect to the server, or the specific folder?

Does Git Bash use a different default directory than / ? Do I need a new user for git?

If it matters, I haven't yet applied any hooks. I will eventually need to use a send-receive hook from my /srv/git/site.git to the actual website HTML located in /srv/www/site.com/public_html.

user2161916
  • 1
  • 1
  • 3
  • Try `git remote add mysite root@11.123.123.123:/srv/git/site.git` (scp style syntax instead of SSH style). Also, why root? – cjc343 Mar 12 '13 at 17:05
  • Same error from that as well (though it no longer mentions that the site.git doesn't appear to be repository, so thats progress). Root because thats what I've been using up to now. Not entirely sure what permissions I need to set on a new user for SSH, so I've been putting that off. – user2161916 Mar 12 '13 at 17:11
  • So what's the full error at this point? Run `ssh root@11.123.123.123 "which git"`, what's the response? Don't run it interactively (or do, but run it non-interactively as well). – cjc343 Mar 12 '13 at 17:30
  • Both interatively and non-interactive give "/usr/bin/git" The full error is `fatal: could not read from remote repository` and tells me to check permissions or file path. – user2161916 Mar 12 '13 at 17:51
  • So much for the non-interactive path theory... If you throw `-v` on your `push`, do you get any additional info? Anything different if you try cloning? It doesn't say anything like `Permission denied (publickey)` before the fatal error? – cjc343 Mar 12 '13 at 18:08
  • May very well have been because I was using the root account. I created a 'git' user, created a .ssh folder and put in my public key. I can log into it now without a password, and git seems to have no problems pushing now! – user2161916 Mar 12 '13 at 18:37
  • Did you ask more or less the same question here? http://stackoverflow.com/questions/15372264/setting-up-git-permission-errors ?? – Anya Shenanigans Mar 12 '13 at 22:17
  • Yes, they are similar, but I have changed a few parameters since this question (no longer using root, so i'm thinking it might be a user permission problem). I thought because I could ssh with my public key that pushing would work. Contrary to my comment above, pushing still does not work. – user2161916 Mar 12 '13 at 23:50

0 Answers0