Skip to content

Instantly share code, notes, and snippets.

@infominer33
Last active January 2, 2021 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infominer33/2d6eb1daa6e0a6bda666b54a22f7905c to your computer and use it in GitHub Desktop.
Save infominer33/2d6eb1daa6e0a6bda666b54a22f7905c to your computer and use it in GitHub Desktop.
Specify ssh key for repository
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