1

I try to setup a git repository on my linux-box (Debian). I want to clone the git repo on my osx Lion. I installed gitosis, create a rsa key my computer (git_rsa), put it to the server, and init gitosis. I have a ~/.ssh/config file because the ssh port isn't the default. I added the git_rsa key to my keychain too. My ~/.ssh/config looks like

Host git

HostName mydomain.com
Port 54321
Identityfile ~/.ssh/git_rsa
User git

when I try to clone the admin repo:

git clone git:gitosis-admin.git

I gave: Permission denied (publickey). fatal: The remote end hung up unexpectedly What is the problem? (The key is chmoded to 700 and ssh is work perfectly with the same key but another user)

Someone can give me a hint how can I resolve this problem?

Thanks in advance.

hcpeter
  • 614
  • 3
  • 11
  • 24
  • You do have a '`git`' account on your server, right? With its `/home/git/.ssh/authorized_keys` having the `git_rsa.pub` content? – VonC Oct 15 '11 at 07:49
  • Yes, I have git account and authorized_keys have the git_rsa.pub content. – hcpeter Oct 15 '11 at 08:02
  • 2
    Just out of curiosity, why gitosis (which is obsolete) and not gitolite? https://github.com/sitaramc/gitolite – VonC Oct 15 '11 at 08:04
  • "ssh is work perfectly with the same key but another user": do you mean another user can clone the gitosis-admin repo? – VonC Oct 15 '11 at 08:06
  • No, If I add this key to an another user authorized_keys I can reach the server. So no 'permission denied' messages... Why gitosis? I want to try git, search in google, and click one of the most relevant link... It was gitosis:) EDIT: I'll try gitolite anyway. – hcpeter Oct 15 '11 at 08:11

3 Answers3

3

Ok I tried gitolite and everything works fine. Here is the method:

  1. Install gitolite with apt-get.
  2. Add the key with gl-setup command.
  3. Clone the gitolite-admin.git repo.

Unfortunatelly I have no idea what was wrong with gitosis.

Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
hcpeter
  • 614
  • 3
  • 11
  • 24
  • So... yet again, the right answer is: gitolite, not gitosis: http://stackoverflow.com/questions/7591958/how-to-change-gitosis-default-search-path/7592421#7592421 – VonC Oct 15 '11 at 16:51
1

I was having trouble with this issue. After a fresh install of gitosis, the clone of repo gitosis-admin.git worked just fine. However, after generating a new RSA key pair, and re-initializing with

sudo -H -u git gitosis-init < id_rsa.pub

I also got the above error.

After comparing the public keys in the generated

id_rsa.pub

and the home of my user for gitosis (git)

/home/git/.ssh/authorized_keys

I noticed, that the public keys didn't match.

After replacing the key in authorized_keys with the content of id_rsa.pub it worked.

Note: Since the authorized_keys file is automatically generated and updated by gitosis, you will also have to make sure, the public key file (id_rsa.pub in my case) is placed in the keydir directory of the gitosis-admin repository.

blacksun
  • 11
  • 2
0

We've our own gitosis server up and running.

The proper command should be-

git clone [server-git-user]@[domain-name.com]:repo.git

So,

git clone git@mydomain.com:gitosis-admin.git

Assuming that you've created a user called git in your server and have something like following in your gitosis.conf

[group gitosis-admin]
members = key_file_name_in_keydir_folder_without_the_pub_extension
writable = gitosis-admin
Rifat
  • 7,628
  • 4
  • 32
  • 46
  • I'm very curious what's wrong with gitosis so I try modify the gitosis.conf but it didn't helped. I'm doing it the exactly same way as you wrote... – hcpeter Oct 16 '11 at 07:02
  • what you've got after trying `git clone git@mydomain.com:gitosis-admin.git`? – Rifat Oct 16 '11 at 07:53
  • permission denied(publickey). I changed the public key to an another one. It seems that gitolite will be the solution for me. – hcpeter Oct 16 '11 at 12:39
  • If you can't fix key problem then most probably gitolite will also not work. BTW, Best of luck with it :) – Rifat Oct 16 '11 at 12:54