Last active
January 2, 2021 03:25
-
-
Save infominer33/2d6eb1daa6e0a6bda666b54a22f7905c to your computer and use it in GitHub Desktop.
Specify ssh key for repository
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
I think you could have multiple entries in ssh config for github, as long as you give it a different hostname and specify the hostname in git config according to which key you want to use. | |
https://stackoverflow.com/questions/4565700/how-to-specify-the-private-ssh-key-to-use-when-executing-shell-command-on-git/18839540 | |
https://gist.github.com/jexchan/2351996 | |
# SSH-ADD | |
`ssh-add ~/.ssh/infoid_rsa` | |
`ssh-add ~/.ssh/infobot_id` | |
# /home/bob/.ssh/config | |
``` | |
Host gitinfo | |
Hostname github.com | |
AddKeysToAgent yes | |
UseKeychain no | |
IdentityFile ~/.ssh/infoid_rsa | |
Host info-bot.github.com | |
Hostname github.com | |
AddKeysToAgent yes | |
UseKeychain no | |
IdentityFile ~/.ssh/infobot_id | |
User git | |
``` | |
# .git/config | |
``` | |
[remote "origin"] | |
url = git@gitserv:Identosphere/identity-blogcatcher.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
``` | |
# .git/config id-bot | |
``` | |
[remote "origin"] | |
url = git@id-bot.github.com:identosphere/static-feedform.git | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment