5
我是一个水银新手,我刚开始使用它。ssh没有要求密码每次与Mercurial
我在本地存储库中工作,当我提交更改时,我使用hg <command> ssh://[email protected]/usr/www/site.com/project
来推送,查看传入/传出更改。
但每一次ssh问我密码。有没有办法记住我的ssh密码用于此目的?另外,我怎么不写每一个完整的命令(ssh://用户等等)?
我是一个水银新手,我刚开始使用它。ssh没有要求密码每次与Mercurial
我在本地存储库中工作,当我提交更改时,我使用hg <command> ssh://[email protected]/usr/www/site.com/project
来推送,查看传入/传出更改。
但每一次ssh问我密码。有没有办法记住我的ssh密码用于此目的?另外,我怎么不写每一个完整的命令(ssh://用户等等)?
你必须用公钥设置你的ssh。网上有很多教程,例如请参阅Getting started with SSH
一旦您拥有了密钥,您可以使用ssh-agent仅在每个会话中输入一次本地私钥密码。此外,还有充当ssh代理的GUI工具(例如,Mac上的SSHKeychain)
或者,如果您的安全性要求不高,您也可以生成无密码的密钥。
但请不要在配置文件中存储明文密码。
有两种可能性,以避免在每个命令键入网址:
从hg help urls
These URLs can all be stored in your hgrc with path aliases under the
[paths] section like so:
[paths]
alias1 = URL1
alias2 = URL2
...
另一种可能是使用的默认路径:
default:
When you create a repository with hg clone, the clone command saves the
location of the source repository as the new repository's 'default'
path. This is then used when you omit path from push- and pull-like
commands (including incoming and outgoing).
那是什么,我经常使用,因为通常你会从某个地方得到你的工作目录海湾克隆,从那时起,我只是不指定url并使用默认值。
您使用的是什么操作系统? – 2011-05-25 05:03:56
Mac OS X和服务器运行Debian。 – 2011-05-25 19:27:10
关于上一个问题,请参阅.hg/hgrc文件中的[paths]部分。 – Ringding 2011-05-26 07:57:49