如何让Windows上的TortoiseHg(Mercurial)使用生成的私钥文件(由Puttygen)?

时间:2010-06-01 15:24:12

标签: mercurial ssh tortoisehg public-key

我使用Puttygen创建公钥和私钥,然后准备让Windows 7上的TortoiseHg通过转到

来克隆
ssh://somebody@code.somewhere.com/somecode

但似乎没有将私钥添加到TortoiseHg的位置? (甚至只是mercurial命令行)

该文件已经在硬盘上的某些位置,因为somefile.ppk有人知道如何添加它吗?

2 个答案:

答案 0 :(得分:77)

将以下内容添加到主目录中mercurial.ini的[ui] -section(假设您的密钥位于“C:\ Users \ UserName \ mykey.ppk”中):

[ui]
ssh = tortoiseplink.exe -ssh -i "C:\Users\UserName\mykey.ppk"

或使用在TortoiseHg安装路径中找到的Pageant(例如C:\ Program Files \ TortoiseHg \ Pageant.exe)。启动它,双击出现的任务栏图标,然后添加.ppk文件。

答案 1 :(得分:0)

    need an ssh key generator first
    1: cmd: ssh-keygen -t rsa
    2: open PuTTY Key Generator
    3:Conversions >  import key: open the id_rsa file in C:\Users\<username>\.ssh   (you may have to create the folder !must run cmd as Admin!)
    4:Save the imported file id_rsa as id_rsa.ppk
    5:Open Pageant.exe in TortoiseHG folder
    6:It will show up in Taskbar
    7:Right click and click add keys
    8:Finally add your new ppk file

Oh right copy the contents of id_rsa.pub to hg host