Skip to content

Instantly share code, notes, and snippets.

@dev-sareno
Last active July 7, 2020 01:13
Show Gist options
  • Save dev-sareno/0d3a39d2183cf1d3fe6a7dffe114c8f5 to your computer and use it in GitHub Desktop.
Save dev-sareno/0d3a39d2183cf1d3fe6a7dffe114c8f5 to your computer and use it in GitHub Desktop.
SSH Config - Using Different SSH keys

SSH Config

Use a multiple ssh keys for different repository/host

/.ssh/config

Host github_repo1.github.com
        User git
        Hostname github.com
        PreferredAuthentications publickey
        IdentityFile C:\Users\User1\.ssh\id_rsa_github_repo1

Repository address

git@github_repo1.github.com:oneras-backend/nestjs-mongodb-demo.git

Usage

$ git clone git@github_repo1.github.com:oneras-backend/nestjs-mongodb-demo.git

This command will be converted to

$ git clone git@github.com:oneras-backend/nestjs-mongodb-demo.git

Notice the "$ git clone git@github_repo1.github.com:oneras-backend/nestjs-mongodb-demo.git" and "Host github_repo1.github.com"

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