【问题标题】:Enabling SSH compression in Sourcetree Windows for a mercurial repository在 Sourcetree Windows 中为 mercurial 存储库启用 SSH 压缩
【发布时间】:2014-02-24 19:24:00
【问题描述】:

我使用的是 Windows 7 - Sourcetree 1.4.1.0 - Embedded Mercurial 2.6.1

Target 是托管在 bitbucket 上的私有 mercurial 存储库。

如何启用 SSH 压缩以加快交易速度?

【问题讨论】:

    标签: ssh mercurial compression bitbucket atlassian-sourcetree


    【解决方案1】:

    通过 Google 快速搜索得到this document:

    编辑 Mercurial 全局配置文件 (~/.hgrc)。将以下行添加到 UI 部分:

    ssh = ssh -C

    完成后,文件应类似于以下内容:

    [ui]
    # Name data to appear in commits
    username = Mary Anthony <manthony@atlassian.com>
    ssh = ssh -C

    在 Windows 上,Mercurial 设置文件位于此处:

    C:\Users\{username}\AppData\Local\Atlassian\SourceTree\hg_local\Mercurial.ini
    

    文件的内容实际上并没有改变,正如它的标题所解释的那样:

    ; System-wide Mercurial config file.
    ;
    ; !!!  Do Not Edit This File !!!
    ;
    ; This file will be replaced by the installer on every upgrade.
    ; Editing this file can cause strange side effects on Vista.
    ;
    ; http://bitbucket.org/tortoisehg/stable/issue/135
    ;
    ; To change settings you see in this file, override (or enable) them in
    ; your user Mercurial.ini file, where USERNAME is your Windows user name:
    ;
    ; XP or older    - C:\Documents and Settings\USERNAME\Mercurial.ini
    ; Vista or later - C:\Users\USERNAME\Mercurial.ini
    

    我没有 Mac,所以无法对此进行测试,但this Atlassian answer 声明此文件的 Mac 位置为:

    /Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local/
    

    【讨论】:

    • 我已经浏览了他们网站上的所有这些文档,问题在于找到 .hgrc 文件,因为我使用嵌入式 mercurial,不知道它是否真的将该文件存储在磁盘上,如果确实如此,不知道它的位置可能在哪里。
    • 我们可以按照该标题中的说明将 ssh = ssh -C 行复制到 ini 文件吗?我现在无法测试,因为我在 Mac 上,这是不久前发布的。如果您可以对其进行测试,那么对其他人也将有所帮助。 Atlassian 可能应该将其包含在他们的文档中。很棒的发现!
    • 此链接有帮助(适用于 Mac,顺便说一句):answers.atlassian.com/questions/138977/… 然后我在Program Files (x86)/Atlassian 中四处寻找,没有找到;在AppData 中环顾四周,找到了它:)
    • 非常酷的发现。感谢您提供额外的链接。这似乎是在 Windows 机器上搜索最合乎逻辑的等价物
    • 看来windows安装文件位于:%LOCALAPPDATA%\Atlassian\SourceTree\hgrc_sourcetree。
    【解决方案2】:

    就我而言,我使用的是 TortoiseHg,但概念应该是相同的。

    这是我原来的c:\somerepo\.hg\hgrc 文件:

    [paths]
    default = ssh://hg@bitbucket.org/someuser/somerepo
    

    那么ssh 发生了什么?让我们在命令行上调试一个 pull 语句 hg pull --debug。我注意到它正在运行 C:\Program Files\TortoiseHg\lib\TortoisePlink.exe 而不是 ssh 来拨打电话:

    PS C:\somerepo> hg pull --debug
    pulling from ssh://hg@bitbucket.org/someuser/somerepo
    running "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -ssh -2 hg@bitbucket.org "hg -R someuser/somerepo serve --stdio"
    sending hello command
    sending between command
    abort: no suitable response from remote hg!
    

    所以让我们重用调用,添加压缩(耶!)、非交互(批处理)和我们的密钥:

    [paths]
    default = ssh://hg@bitbucket.org/someuser/somerepo
    
    [ui]
    ssh = "C:\Program Files\TortoiseHg\lib\TortoisePlink.exe" -ssh -2 -C -batch -i "c:\keys\somekey.ppk"
    

    【讨论】:

      猜你喜欢
      • 2018-06-29
      • 2011-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-04
      • 2013-03-04
      • 1970-01-01
      • 2011-03-17
      相关资源
      最近更新 更多