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.
For the past 12 years, I’ve been developing applications for the web using mostly PHP. I do this for a living and love what I do as every day there is something new and exciting to learn.
In my spare time, the web development community is a big part of my life. Whether managing online programming groups and blogs or attending a conference, I find keeping involved helps me stay up to date. This is also my chance to give back to the community that helped me get started, a place I am proud to be apart of.
Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie, staying in playing games on the sofa or planning a trip to someplace I’ve never been before.