Johann Savalle

@yasha.solutions

Product designer and full stack developper living in france
< Back to all articles

Set up a different an SSH key for git push for a give repository

December 12, 2018

ok so I add the following problem to deal with.

Posted here for reference.

Source

Even if the user and host are the same, they can still be distinguished in ~/.ssh/config. For example, if your configuration looks like this:


Host gitolite-as-alice
  HostName git.company.com
  User git
  IdentityFile /home/whoever/.ssh/id_rsa.alice
  IdentitiesOnly yes

Host gitolite-as-bob
  HostName git.company.com
  User git
  IdentityFile /home/whoever/.ssh/id_dsa.bob
  IdentitiesOnly yes


Then you just use gitolite-as-alice and gitolite-as-bob instead of the hostname in your URL:


git remote add alice git@gitolite-as-alice:whatever.git
git remote add bob git@gitolite-as-bob:whatever.git

< Back to all articles