Skip to content

Instantly share code, notes, and snippets.

@davidbarkhuizen
Last active October 13, 2022 08:46
Show Gist options
  • Select an option

  • Save davidbarkhuizen/dca1df746b379f5694968f9a8adbd6dc to your computer and use it in GitHub Desktop.

Select an option

Save davidbarkhuizen/dca1df746b379f5694968f9a8adbd6dc to your computer and use it in GitHub Desktop.
ssh-notes

configuring different ssh keys for different servers

  1. create entry in config file @ ~/.ssh/config:

Host host_alias HostName host_name IdentityFile ~/.ssh/rsa_pvt_key User user_name <<<

  1. configure git origin to use alias

$ git remote add origin git@host_alias:repo_owner_name/repo_name.git

so, if the original url was [email protected]:yoco-dev/yoco-core.git and we have created an entry in config with host alias bitbucket, e.g.

Host bitbucket HostName bitbucket.com IdentityFile ~/.ssh/my_bitbucket_public_key User my_bitbucket_user

git remote add origin git@bitbucket:yoco-dev/yoco-core.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment