When using SSH with GitHub you'll often need to add deploy keys to the repo to allow read and write access over SSH. This can be problematic when using multiple repositories as Github won't allow the same deploy key (ssh key) to be used on multiple repositories.
There are a few options at this point:
- Move the deploy key from one repo to another
- Setup multiple keys one per project
- Set a key on your account that will work for all your repositories
I opt the setting a key on my account. This way every repository I have in my account will allow the SSH connection, this is how the GitHub desktop clients works too.
1) open terminal and generate a new id_rsa key (if you've already got a key this step can be skipped).
Generating public/private rsa key pair. Enter file in which to save the key (/home/username/.ssh/id_rsa):
Press enter to accept the default path
Enter passphrase (empty for no passphrase):
Press enter to accept no password or enter a password first.
The response will look something like:
The key's randomart image is: +--[ RSA 2048]----+ | .. . .oB| | . .. + .++| | . o. o...| | o . | | S .. . | | o. o | | o..+ | | ....o | | oE. | +-----------------+
Get the key:
Go to .ssh folder
Next open rd_rsa in vim:
Copy the key be careful not to copy any whitespace
Exit vim by pressing: followed by wq
Add key to your GitHub account
Go to your account settings and click on 'SSH and GPG keys https://github.com/settings/keys
Click on New SSH Key
Give the key a name I put my laptop name here followed by the key you copied (id_rsa) click Add SSH Key.
Done now whenever you perform an action over SSH on the machine the connection will be authorised.