Mercurial和Git自定义SSH密钥位置 [英] Mercurial and Git custom SSH key location

查看:137
本文介绍了Mercurial和Git自定义SSH密钥位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

存在那里为每个克隆的repo定义它应该使用哪个SSH密钥对的路径的方法吗?

解决方案

是,您需要定义一个〜/ .ssh / config 文件,您可以在其中声明不同的ssh名称,并使用公用/私用密钥的自定义完整路径名称。

 主机AHostName  - 您将用于ssh地址的名称
用户gituser
主机名SSH IP地址
端口1234 - 如果您需要自定义端口,请使用此
IdentityFile私钥ssh密钥的路径

从这里,回购的ssh url可以是:

$ p $ AHostName:myrepo

另见:


  • git + assembla +多个ssh密钥/多台计算机

  • < a href =https://stackoverflow.com/questions/12066895/how-to-work-on-personal-github-repo-from-office-computer-whose-ssh-key-如何从办公室电脑的个人GitHub回购工作,其SSH密钥已添加到与工作相关的GitHub账户?


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:

这篇关于Mercurial和Git自定义SSH密钥位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆