views:

1174

answers:

6

I've set up Gitosis on a remote Ubuntu box which I will refer to as linuxserver as my host in the following commands. I'm also connecting from a Windows box using Cygwin.

I followed the instructions according to: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

I had no problems up until I needed to clone the gitosis-admin repository to my local machine

git clone git@linuxserver:gitosis-admin.git

When I do this, the command executes, but hangs there displaying nothing until I ctrl-c to get back to a command prompt. No messages are displayed at all.

I'm pretty sure I have my ssh keys set up properly, because logging in using "ssh linuxserver" into my regular account works perfectly without asking for a password.

Edit: Over the weekend I set up a near identical Ubuntu box at home, and had no problem setting up Gitosis. The only difference was that I was connecting from OSX instead of Cygwin.

Edit: I've also discovered that when using the Bash Shell provided with "Git Extensions", I have no problems, so the issue definitely seems to be some kind of Cygwin conflict.

Edit: Just an update, but about a month after posting this question, I switched to Mercurial, and found that I prefer it much more than git. Thanks for the suggestions, but I don't plan on going back to git to try any of them out.

+1  A: 

Did you check /var/log/messages on your server?
May be the username 'git' does not work properly: From the comments of Gitosis,

if you look at the authorized_key file you will see that it did not import the name of the system that key was generated on but the name of the server box.

Example: using a username of “git” resulted in this in the authorized key

root@git-repo:/home/git/.ssh# cat authorized_keys command=”gitosis-serve root@git-repo”

After changing to user name “gitosis” it looks like this

root@git-repo:/home/gitosis/.ssh# cat authorized_keys command=”gitosis-serve myuser@mylocalbox”,

To fix I created a user gitosis with home dir of /home/gitosis and ran the git-init script again.

sudo -H -u gitosis gitosis-init < /tmp/id_rsa.pub
sudo chmod 755 /home/gitosis/repositories/gitosis-admin.git/hooks/post-update

then, on local box..

git clone gitosis@YOUR_SERVER_HOSTNAME:gitosis-admin.git
VonC
The first part of your answer is completely off the mark. You should remove it, so as to avoid confusing new readers. The second part seems to be right, but needs to be reformatted.
Novelocrat
@Novelocrat: I removed the first part. I am not sure about the "reformatting" you want so I set this answer as CW (Community Wiki): you can edit it and reformat it as you want.
VonC
+1  A: 

I found these instructions provided more explanation of what you are doing when you install gitosis. Might help someone.

srboisvert
Thanks for the additional info. I'd try it out, but I've since moved on to Mercurial (and loving it).
Tim Rupe
+1  A: 

I had the same problem as you and my solution to the problem was to add the user "git" to the allowed users in the ssh config file on the server. A basic oversight - yes - but as I followed the same tutorial and this step is not mentioned it could easily be that other people forgot about adding the git user to the ssh config file.

markmywords
+1  A: 

I had similar problem on my computer. I installed gitosis on Archlinux and it works when running

git clone ssh://git@localhost/oslab.git

But if I change the localhost to IP like 192.168.1.1, it hangs.

ZelluX
+1  A: 

I'd also recommend setting the debug option in the conf.

[gitosis]
loglevel = DEBUG
srboisvert
A: 

If anyone else has had this problem, and was trying to connect from a Cygwin environment on a client that also had Msys Git installed, check the value of the GIT_SSH environment variable. It should be unset or equal to /usr/bin/ssh not plink.exe

I was able to ssh to the server as the git user (with the expected rejection from the gitosis scripts), however I was unable to clone.

I realised something strange was happening because git was still warning that the host was unknown whereas a direct ssh connection did not. This was confirmed when I looked in to the output from strace

strace git clone git@server:gitosis-admin.git | less

Searching for the sting "ssh", showed that GIT_SSH pointed to plink.exe - the putty ssh client used by Msys Git. Not sure why plink.exe didn't work, but setting GIT_SSH=/usr/bin/ssh fixed things.

Seb