Example config ssh client for a gitolite admin AND user

[linkstandalone]


tl;dr: the Hostname setting will help you if you have multiple SSH keys for a given user on a remote server. man ssh_config is your friend.



Hello everyone,

This post is a remainder for myself.
Here's the problem: you've installed gitolite on your server and want to do the following:

After crawling through the ssh_config man page for what to put in the Hosts blocks, the Hostname part seemed very interesting for the use case.
In the end my ~/.ssh/config was similar to this:

Host admin_gitolite
    Hostname git.domain.com
    IdentityFile ~/.ssh/admin_gitolite
    User gitolite

Host user_gitolite
    Hostname git.domain.com
    IdentityFile ~/.ssh/user_gitolite
    User gitolite

Host gitserver
    Hostname git.domain.com
    IdentityFile ~/.ssh/gitserver
    User normaluser

Now you can rename your gitolite-admin remote repo url as ssh://admin_gitolite:/gitolite-admin and ssh will understand it.
Same goes for user_gitolite and the gitserver host is for plain simple ssh access.

That's all I've got to say, merry Christmas to you and good holidays! 🎄🎄🎄