Can’t clone gitosis-admin.git local from the snow leopard server running gitosis

gitosx-snow-leopard

I've installed gitosis as described here:
http://gist.github.com/264304

One of the things that I had to adjust was to give my git user permissions to use ssh (which I did trough server admin -> access -> ssh and added the 'git' user).

When I ssh from my local machine (mac osx) as the git user, I get this response:

PTY allocation request failed on channel 0
bash: gitosis-serve: command not found
                                      Connection to 10.0.0.108 closed.

Which I think is normal, because in Pro GIT the author says you should get something like this if you try ssh'ing to the server using your git user:

PTY allocation request failed on channel 0
fatal: unrecognized command 'gitosis-serve schacon@quaternion'
  Connection to gitserver closed.

So far so good, I think? Now when I try to clone my gitosis-admin.git repository using this command:

$git clone git@10.0.0.108:gitosis-admin.git

I get this:

Initialized empty Git repository in /Users/joggink/gitosis-admin/.git/
bash: gitosis-serve: command not found
fatal: The remote end hung up unexpectedly

So after doing some searching, I found an answer here on serverfault claiming I should use ssh:// as protocol for my git clone (which I thought is the default git protocol?)
However, when I try:

$git clone ssh://git@10.0.0.108:gitosis-admin.git

This is the response:

The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 80:4d:77:c7:78:cb:c9:42:e3:82:06:7c:fe:c0:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:
Password:
Password:
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly

When I type in my own password (because my git user has no password), I get following error:

The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 80:4d:77:c7:78:cb:c9:42:e3:82:06:7c:fe:c0:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly

I added my upload-pack location as followed:

$git clone -u /usr/local/git/bin/git-upload-pack ssh://git@10.0.0.108:gitosis-admin.git

I get the error that gitosis-admin.git isn't a git repo…

Initialized empty Git repository in /Users/joggink/gitosis-admin/.git/
The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 80:4d:77:c7:78:cb:c9:42:e3:82:06:7c:fe:c0:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:
fatal: 'git@10.0.0.108:gitosis-admin.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I've been searching for a solution for almost a week now, and every topic I've found on the internet gives no result…

Best Answer

I always had the same problem, and it is a little tricky to find out the reason. I tried exchanged the server name by the IP:

git clone git@frontend1:gitosis-admin.git

by

git clone git@192.168.155.101:gitosis-admin.git

and got the message that the gitosis-serve was not found, i.e., the /usr/local/bin path is not included when calling gitosis-serve with the .ssh/authorized_keys.

Therefore, in the file ~git/.ssh/authorized_keys (as the admin) I exchanged gitosis-serve by /usr/local/bin/gitosis-serve, i.e., the full path name. Afterwards, the command

git clone git@frontend1:gitosis-admin.git

worked fine.