Mercurial and Git custom SSH key location

2019-02-27 00:17发布

Exists there any way to define for each cloned repo the path of which SSH key pair it should use?

1条回答
我命由我不由天
2楼-- · 2019-02-27 00:37

Yes, you need to define a ~/.ssh/config file, in which you can declare different ssh names, with a custom full path name for the public/private key to use.

Host AHostName -- name you will use for the ssh address
User gituser
Hostname SSH IP address 
Port 1234 -- use this if you need custom ports
IdentityFile "path to your private ssh key"

From there, the ssh url of the repo can be:

AHostName:myrepo

See also:

查看更多
登录 后发表回答