【问题标题】:Clone SSH repository with non-standard port number to SourceTree将具有非标准端口号的 SSH 存储库克隆到 SourceTree
【发布时间】:2016-03-25 17:19:12
【问题描述】:

我花了大约 20 分钟来解决这个问题。

我收到了一个存储库的 SSH 地址的电子邮件。至关重要的是,它有一个非标准(即不是 22)端口号: git@domain.com:1234/opt/git/repository.git

我以为我可以将其复制粘贴到 SourceTree 中,但不断收到 This is not a valid source path / URL 错误消息。

当我仔细查看日志时,错误是它正在服务器上寻找路径 1234/opt/git/repository.git - 它正在将 端口号 视为路径的一部分。显然没有找到 repo。

【问题讨论】:

    标签: git url ssh atlassian-sourcetree sourcetree


    【解决方案1】:

    解决方案有点奇怪:

    1. 使用 ssh://git@domain.com:1234:/opt/git/repository.git 之类的路径。 附加ssh://,并在端口号后添加: 似乎成功充当分隔符,并且在服务器上(如预期的那样)找到了路径/opt/git/repository.git
    2. Add the domain/port number to your config file(例如~/.ssh/config)使其看起来像这样:

    Host domain.com Port 1234

    【讨论】:

    • 我在运行 Git 服务器的 Synology NAS 上尝试了您的答案。但是,我必须删除端口号后的“:”才能获得有效的 URL。因此,对我来说是(使用你的例子): ssh://git@domain.com:1234/opt/git/repository.git
    • 与@Peter 报告的情况相同。
    猜你喜欢
    • 2015-03-15
    • 2017-07-28
    • 1970-01-01
    • 2022-01-24
    • 2018-06-22
    • 2014-01-10
    • 2011-05-24
    • 2019-10-03
    • 2017-08-07
    相关资源
    最近更新 更多