Search code examples
gitsshgitosis

git over ssh: Repository read access denied


I have a git server set up on Linux, and it's working great:

[git@HOST ~]$ git clone -v git://HOST.com/repositories/Extras
Cloning into Extras...
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 3), reused 0 (delta 0)
Receiving objects: 100% (12/12), 23.54 MiB | 16.63 MiB/s, done.
Resolving deltas: 100% (3/3), done.

Note that HOST.com is not real. :)

I would now like to get the same thing working over SSH, so I can add privacy and authentication. At the moment, it is not working:

[git@HOST ~]$ git clone -v ssh://HOST.com/repositories/Extras
Cloning into Extras...
Enter passphrase for key '/home/git/.ssh/id_rsa':
ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly

It looks like the SSH connecting is working, but git is having some permissions problems. SELinux is not enabled.

In /var/log/messages, I see the following:

Sep 23 16:26:18 HOST sshd[32115]: Accepted publickey for git from X.X.X.X port 51023 ssh2
Sep 23 16:26:18 HOST sshd[32116]: fatal: mm_request_receive: read: Connection reset by peer
Sep 23 16:26:18 HOST sshd[32115]: pam_unix(sshd:session): session opened for user git by (uid=0)
Sep 23 16:26:19 HOST sshd[32121]: Received disconnect from X.X.X.X: 11: disconnected by user
Sep 23 16:26:19 HOST sshd[32115]: pam_unix(sshd:session): session closed for user git

Anyone have some advice on where I might start looking?

Thanks! Mike


Solution

  • Thanks everyone... In the end I went with gitolite, but that was not the source of the problem. It was a key mismatch between the client and the SSH server... A simple thing that I thought I'd checked. Once I matched up the user's .pub key that I had registered with git, and their ~/.ssh/id_rsa.pub, everything started working as expected.

    Thanks!

    Mike