Skip to content

Commit

Permalink
Update with more details
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsimper committed Dec 9, 2024
1 parent 3243266 commit 7ddca6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/blog/posts/how-to-manage-multiple-ssh-keys-with-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ But that is not a great solution, because they suggest changing the hostname, so
Better solution is simply specify which key to use per repository.

```bash
git config core.sshCommand 'ssh -i ~/.ssh/id_rsa_corp'
git config core.sshCommand 'ssh -i ~/.ssh/id_rsa_corp -o IdentitiesOnly=yes'
```

That however requires you to be able to clone the repository first, but that you can do with
Expand All @@ -21,4 +21,6 @@ That however requires you to be able to clone the repository first, but that you
GIT_SSH_COMMAND="ssh -i /path/to/your/private/key -o IdentitiesOnly=yes" git clone [email protected]:user/repository.git
```

So this way you can easily control which key get used for which repository.
So this way you can easily control which key get used for which repository.

`-o IdentitiesOnly=yes` is important if you are using a SSH Agent (which you most likely), and that means by default `-i` will be ignored if not.

0 comments on commit 7ddca6f

Please sign in to comment.