Search code examples
gitolite

Sourcetree on Mac connecting to Gitolite asks for authentication


We've recently set up Gitolite server. All seems well. I can connect to it without a problem.

A new user has been set up, he's on a Mac and trying to use SourceTree. The only way I could get him to connect was for him to attempt to ssh to the server and I typed in the password (exited afterwards). Without that the system kept asking for a password for that server.

Is this normal behaviour? How do non-sysadmin users gain access to gitolite?


Solution

  • Gitolite is based on forced command, which means non-interactive session.
    So:

    • no password should ever be entered (assuming here non-password protected private key).
      (as detailed in "how gitolite uses ssh").
    • no "non-sysadmin" should ever gain access to gitolite server itself.

    So all he should need is a public key stored in ~/.ssh (making sure both his home and .ssh aren't group or world writable), registered in gitolite-admin/keys and published on the gitolite server .ssh/authorized_keys file.

    From there, as mentioned in "Sourcetree and Gitolite":

    If you are cloning a remote git repository, you need to tab out of the Source path/ URL field to activate the clone button.
    The url will be validated at that point.

    The url needs no special syntax working with gitolite, and even respects the host entries in your ssh conf file. So in my case a url of gitolite:workrepo is sufficient.