2011-05-25 72 views
5

我是一個水銀新手,我剛開始使用它。ssh沒有要求密碼每次與Mercurial

我在本地存儲庫中工作,當我提交更改時,我使用hg <command> ssh://[email protected]/usr/www/site.com/project來推送,查看傳入/傳出更改。

但每一次ssh問我密碼。有沒有辦法記住我的ssh密碼用於此目的?另外,我怎麼不寫每一個完整的命令(ssh://用戶等等)?

+0

您使用的是什麼操作系統? – 2011-05-25 05:03:56

+0

Mac OS X和服務器運行Debian。 – 2011-05-25 19:27:10

+0

關於上一個問題,請參閱.hg/hgrc文件中的[paths]部分。 – Ringding 2011-05-26 07:57:49

回答

4

你必須用公鑰設置你的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並使用默認值。

相關問題