Gitolite: can connect via ssh, cannot clone

I installed gitolite on my server using this tutorial . This applies to the non-root method.

This fails when I try to clone gitolite-admin back to my client. I get this error message:

git clone gitolite@server.com :gitolite-admin Cloning into gitolite-admin... fatal: The remote end hung up unexpectedly 

also:

 git clone ssh:// gitolite@server.com :gitolite-admin Cloning into gitolite0admin... Using username "git-upload-pack 'gitolite". fatal: The remote end hung up unexpectedly 

I also tried adding .git to the end of the repo name, and I also tried to add repositories/gitolite-admin (suggested by the errors in the tutorial above), and a combination of both of them and none of the work work. I can’t find any results on google regarding the “Using username” bit, which intrigues me.

I can connect to the machine via ssh, and it tells me that I have access to R and W gitolite-admin . So does SSH work?

+4
source share
2 answers

Check the ssh parts about githolite : the fact that you can connect to server.com through ssh means only:

  • Your ssh key is registered in server.com@ ~/.ssh/authorized_keys
  • this key is not associated with gitolite "there is no option" command= ", which means" no matter what the incoming user requests, instead force this command ").
    You are in an interactive session that can execute any command that you like.

What I don't like at all in the third-party tutorial is that it is trying to use the same name for the git user and the ssh non-root user

You must keep separate :

  • non-root user ( which is not an account ), just the ssh key that will be associated with gitolite, with administrator privileges for gitolite-admin REPO transactions)
  • hosting account , which should be " git ", not gitolite , namely to avoid confusion between the two modes of use :
    • git ( log in directly to server.com , no ssh here ): the interactive session needed to execute the git command (e.g. cloning the gitolite repository server and executing gitolite/src/gl-system-install )
    • ssh git@server.com , which will use your public and private keys ~/.ssh/id_rsa(.pub) , which, as gitolites, will allow you to clone the gitolite-admin repository and push the repo back

Yet again:
"gitolite" is not a real account, but only the name allowed to execute commands on server.com as " git " (the actual "hosting account", as in the "git and repo hosting services").
All other git users will also execute git commands on server.com as git .
And this particular user ( gitolite ) will be associated with the gitolite authorization level through a forced command mechanism with privilege settings during gitolite installation to provide the user with the right to clone, modify and roll back the gitolite-admin repo .
(This is its only feature compared to all the other ssh git users you add: they will not have access to this particular git repo, which is gitolite-admin )

Trying to give a name with the same name, you just ask problems.

I don’t like to use the default naming convention for public / private keys, so I prefer to define these keys on the client with the name of the intended user:

 ~/.ssh/gitolite.pub ~/.ssh/gitolite 

Then I define the configuration file: ~/.ssh/config with it:

 host gitolite user git hostname server.com identityfile ~/.ssh/gitolite 

(Pay attention to the user here: always git )
Then I can clone my gitolite-amin repo:

 git clone gitolite:gitolite-admin # modify locally # git add -A ; git commit -m "my modifs" git push origin master 
+7
source

For posterity, the fix is ​​to make sure GIT_SSH is not installed in TortoisePlink.exe. Git cannot use it.

+1
source

All Articles