-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3243266
commit 7ddca6f
Showing
1 changed file
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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. |