tags:

views:

3074

answers:

3

Hi, all

I'm confronted with some problems when trying to configure gitosis on my Archlinux

http://wiki.archlinux.org/index.php/Setting_Up_Git_ACL_Using_gitosis

I referrer to this wiki article and successfully installed gitosis

$ sudo pacman -U gitosis-git-20090525-1-i686.pkg.tar.gz
$ sudo -H -u gitosis gitosis-init < /tmp/id_rsa.pub

and modify /srv/gitosis/.ssh/authorized_keys to include my local user's id_rsa.pub

then i run git clone as the local user

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

it says

Initialized empty Git repository in /home/wyx/gitosis-admin/.git/
[email protected]'s password: *
fatal: 'gitosis-admin.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

As a result, the git clone operation failed. I'm wondering why it init empty git repository in my local user's directory (/home/wyx)? And since i've already added local user's id_rsa.pub in .ssh/authorized_keys, why does it still ask for password?

+8  A: 

An empty repository was created because that's just how git works: it has to init a repo before it can start pulling remote objects into it. Unfortunately this means you'll have to manually delete the empty repo before you try cloning again.

As for why the clone failed, it looks like you're using the wrong syntax for the remote repository path; git clone doesn't use scp syntax. In fact, if you don't specify a clone protocol, I believe it assumes the git protocol rather than ssh, which would probably be why it asked you for a password. Try this instead:

$ git clone ssh://gitosis@host/~/gitosis-admin.git
Niten
Thanks for your reply.Finally i find the problem lies in that i use the wrong public rsa key, and ssh:// syntax is another mistake.
ZelluX
As of git 1.6+, you don't have to specify the protocol. So user@host:reponame.git will work.
Shoan
+2  A: 

Hi, I have exactly the same problem - could you please expand further on "wrong public rsa key"? I'm unsure that ssh:// syntax is the right answer, as all the tutorials I've seen use the OP syntax.

DJC
A: 

Gitosis creates it's own authorized_keys file. If you already have that file, delete it and allow gitosis-init to recreate it. Once that's done, don't mess with the file.

Shoan