ssh-keygen -t rsa -b 4096 -C "[email protected]"
ssh-add id_rsa_mjrulesamrat
Create config file and add multiple hosts to accomodate different accounts of github, bitbucket or gitlab.
vim ~/.ssh/config
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
Host mjrulesamrat.github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_mjrulesamrat
Other examples of different accounts:
-
mjrulesamrat.gitlab.com
-
mjrulesamrat.bitbucket.org
Add id_rsa_mjrulesamrat.pub
to github account ssh keys
cat ~/.ssh/id_rsa_mjrulesamrat.pub
git clone [email protected]:mjrulesamrat/docker-commands.git
hi,
The above solution didn't work for me as well.
Key pointers:
Host
. Initially, to a new user, it seems like theHost
is defining something related to theGitHub
and can differ based on the individual or company level. After doing some research, I understood that it is a custom name given by the user to refer to thehost
it wants to talk to.config
is missing with the two fields as given below:AddKeysToAgent
: Basically it will instruct if the same can be added to the agentUser
: Who is theuser
? Which in this scenario isgit
.Finally, the below code snippet helped me achieve the goal,
Please correct me If I am wrong in the
Explanation
.Thanks for this article @mjrulesamrat . It did helped me