2010-04-04 59 views
13

我想克隆我的個人fork在github上使用git + ssh協議與TortoiseHg。這給了我一個相當奇怪的錯誤。這裏是命令使用TortoiseHg克隆讀寫github存儲庫

hg clone git+ssh://[email protected]:myusername/thefork.git 

這是我安裝了hg-git模塊之後,它工作得很好,使用git://語法進行克隆。但我相信它在使用ssh時遇到了麻煩。我得到的錯誤是這個。

importing Hg objects into Git 
[Error 2] The system cannot find the file specified 

我曾嘗試手動將SSH命令到mercurial.ini文件中像這樣

[ui] 
username = [email protected] 
ssh="C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -i "C:\Source\SSHPrivateKey.ppk" 

但我仍然得到同樣的錯誤。有任何想法嗎?

更新1

如果我運行從Git的Bash的同一命令shell它工作得很好。我明白了。

importing Hg objects into Git 
Counting objects: 1559, done. 
Compressing objects: 100% (586/586), done. 
Total 1559 (delta 960), reused 1534 (delta 947) 
importing Git objects into Hg 
at: 0/86 
updating to branch default 
219 files updated, 0 files merged, 0 files removed, 0 files unresolved 

我假設這是因爲它可以找到ssh.exe,我的密鑰已經導入。我可以將ssh.exe的路徑添加到Windows命令提示符路徑中,然後代替先前的錯誤,我可以獲得此信息。

importing Hg objects into Git 
Permission denied (publickey). 
abort: the remote end hung up unexpectedly 

它似乎對ssh.exe eventhough我已指定在mercurial.ini備用SSH路徑尋找具體。但我的猜測是,該配置僅適用於啓用了ssh的mercurial服務器,並不適用於hg-git插件。

+0

自我提醒 - 要有耐心。一旦我學會了等待5分鐘左右的時間,就可以克隆一個非常大的回購,hg-git工作得很好。 – 2011-03-07 06:44:02

回答

8

我發現了一個解決方法,但它很hackish。我注意到ProcessMonitor顯示它在幾個不同的路徑中查找ssh.exe,所以我複製了TortoiseHg文件夾中的TortoisePlink.exe並將其命名爲ssh.exe。

copy "C:\Program Files\TortoiseHg\TortoisePlink.exe" "C:\Program Files\TortoiseHg\ssh.exe" 

只是這個改變,它仍然會失敗的身份驗證。你會得到一個彈出框和這個。

importing Hg objects into Git 
abort: the remote end hung up unexpectedly 

所以你需要得到pageant.exe that comes with the main PuTTy install的舉行。開始並將您的密鑰添加到它。然後再次運行clone命令,它應該進行身份驗證。

+0

複製步驟不需要在我的盒子上。只需從提供的鏈接@Nathan安裝putty-0.60-installer.exe,然後從「開始」菜單啓動pageant.exe即可。之後,你可以添加你的GitHub鍵。 – 2011-04-23 11:13:41

0

我使用的是「plink.exe」和「pageant.exe」,而不是「TortoisePlink.exe」。當「plink.exe」需要時,「pageant.exe」自動提供密碼短語。

+0

你在mercurial.ini中使用的配置是什麼?我試過普通的PuTTY發行版中的plink.exe,但是我得到了同樣的錯誤。 – 2010-04-04 13:15:46

0

我通過將TortoisePlink.exe複製到ssh.exe來解決了這個問題。然後我將ssh.exe放入我的路徑中。只要選美比賽正在進行,那對我來說就很有用。

鑑於我需要ssh.exe在我的路徑,我不知道如果hggit甚至讀取ssh =行。

這仍然是hackish的,但比@彌敦道的技術少一點hackish的(我不是\ Program Files文件中的文件搞亂的粉絲)

0

我發現我已經發動佳麗和加載我的SSH密鑰然後開始克隆使用命令行例如:

hg clone git+ssh://[email protected]/<username>/<repo>.git 

但從此之後,我可以使用TortoiseHg對GitHub的(推拉)就好了(雖然佳麗需要運行認證工作)。

2

花了幾個小時試圖解決這個問題後,我找到了一個指導,它完美地解釋了它。

這是網址:指南中沒有提到 http://www.codeproject.com/Articles/376058/Step-by-step-Setup-TortoiseHg-for-gitHub

一件事是,與TortoiseHG捆綁佳麗的32位版本不能在URL識別「混帳@」的一部分,並一直要求它。下載64位版本的Pageant可修復此錯誤。

下載64位佳麗: https://splunk.net/w/PuTTy64bit

我已經開了票,其中包括64位佳麗與TortoiseHG: https://bitbucket.org/tortoisehg/thg/issue/2145/bundle-64-bit-pageant-with-64-bit

+0

這似乎與THG v2.5.1一致。我的選美是.x64,我沒有碰過它。 – 2012-12-03 01:51:36