Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to access two different private repositories created by me

i am having trouble pulling from two different private repos. I followed the instructions around here and created a deploy key in my github private repo. I have two private repos of the form:

https://github.com/moonresearch/trading-engine
https://github.com/moonresearch/dbreader

Now, when i went to my dbreader repo, i went to the settings section and added deploy keys from following the following steps:

ssh-keygen -t rsa -b 4096 -C "me@github.com"
eval "$(ssh-agent -s)”
ssh-add ~/.ssh/id_rsa

I then went to my id_rsa.pub file located in ./ssh/id_rsa.pub and copied the contents and pasted into my deploy keys for the repo dbreader. After the above steps, i can successfully do the following:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

git clone git+ssh://git@github.com/moonresearch/dbreader.git  

Now, when i do the same for the first repo, i am seeing a message "key already in use". Then i created a new key called id_rsa_docker and pasted into the deployment key section for the first repo.

From my understanding here, i am supposed to create a config file in order to manage multiple deploy keys. So i went ahead and created one in ./ssh directory:

Host https://github.com/moonresearch/dbreader
   Hostname github.com
   IdentityFile=/Users/raj/.ssh/id_rsa

Host https://github.com/moonresearch/trading-engine
   Hostname github.com
   IdentityFile=/Users/raj/.ssh/id_rsa_docker

After the above steps, i tried a

git clone git+ssh://git@github.com/moonresearch/trading-engine.git

I am still not able to get it to clone properly. Error i am getting is: remote repository not found.

>Solution :

Your ~/.ssh/config file should be:

Host dbreader
   Hostname github.com
   User git
   IdentityFile=/Users/raj/.ssh/id_rsa

Host trading-engine
   Hostname github.com
   User git
   IdentityFile=/Users/raj/.ssh/id_rsa_docker

And your URLs:

git clone dbreader:moonresearch/dbreader.git
git clone trading-engine:moonresearch/trading-engine.git
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading