Mercurial和Git自定义SSH密钥位置 [英] Mercurial and Git custom SSH key location
本文介绍了Mercurial和Git自定义SSH密钥位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
存在那里为每个克隆的repo定义它应该使用哪个SSH密钥对的路径的方法吗?
解决方案
是,您需要定义一个〜/ .ssh / config
文件,您可以在其中声明不同的ssh名称,并使用公用/私用密钥的自定义完整路径名称。
主机AHostName - 您将用于ssh地址的名称
用户gituser
主机名SSH IP地址
端口1234 - 如果您需要自定义端口,请使用此
IdentityFile私钥ssh密钥的路径
从这里,回购的ssh url可以是:
$ p $ AHostName:myrepo
另见:
Exists there any way to define for each cloned repo the path of which SSH key pair it should use?
解决方案
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:
- "git + assembla + multiple ssh keys/multiple computers"
- "How to work on personal GitHub repo from office computer whose SSH key is already added to a work related GitHub account?"
这篇关于Mercurial和Git自定义SSH密钥位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文