Reputation: 4337
On my windows 7, i have created a config file that is residing in .ssh folder:-
Host office
Hostname git@officeserver
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Host home
Hostname [email protected]:8888
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_home
but, I still unable to clone repo.
Upvotes: 2
Views: 493
Reputation: 11935
Your hostname setup is wrong, it shouldn't have the username, only the hostname
Here an example, I am using .ssh/config to keep multiple identities (each one with different key pair) on github.com:
#Default GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
Host github-companyname.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_companyname
Host git.i411-companyname.com
HostName git.i411-companyname.com
User git
IdentityFile ~/.ssh/id_rsa_companyname
This is how your config file should look:
Host office
Hostname officeserver
User git
IdentityFile ~/.ssh/id_rsa
Host home
Hostname myhome.net
User git
Port 8888
IdentityFile ~/.ssh/id_home
Note you cant include usernames or port on Hostname, you should specify those on different config variables (User and Port)
Upvotes: 1