SSH for github
How to configure multiple two or more deploy keys for different private github repositories on the same computer without using ssh-agent
Let's say I want to have a ssh key A for repo1 and ssh key b for repo2.
- Create a ssh pair keys for each repository
For the second key and the subsequent ones, you will need to specify a different name.
- Private key should have permissions set to 600.
-
.ssh folder should have permissions set to 700.
-
Add your SSH keys to the ssh-agent. In my case
-
Add your ssh public keys as deploy keys in the Settings tab of repo1 and repo2 .
-
Edit .git/config file in both repositories.
- For each repo set name and email
- Create a config file in .ssh to manage keys:
- Make sure you don't have all credentials cached in your ssh agent
- Add new credentials to your ssh agent
- See added keys
- Test your conection