【问题标题】:git clone requires ssh:// protocol when perhaps it shouldn't?git clone 可能不需要 ssh:// 协议?
【发布时间】:2010-07-30 04:59:28
【问题描述】:

我的一个同事有一个我想克隆的远程 git repo,他提供了一个 git@his.server.com:443/repo.git 的 url。在这种情况下,ssh 在端口 443 上列出。

我尝试通过执行git clone git@his.server.com:443/repo.git 进行克隆,但操作超时。我曾认为 git 默认使用 ssh 作为其协议,但我不确定为什么这不起作用。

如果我像git clone ssh://git@his.server.com:443/repo.git 这样在url 中明确指定ssh,它就可以正常工作。

这是预期的 git 行为吗?为什么第一个网址不起作用,而第二个网址起作用?

【问题讨论】:

    标签: git ssh


    【解决方案1】:

    是的。 “默认”克隆语法类似于 scp。 scp URL 看起来像“user@host:path”。注意冒号;如果你使用git@his.server.com:443/repo.git,Git 认为你正在尝试从git@his.server.com 克隆路径443/repo.git。如果您需要指定端口,则必须使用 ssh 样式的语法(正如您最终所做的那样)。

    【讨论】:

    • 或者使用.ssh/config指定端口。
    • 您的意思是每个客户都必须编辑其~/.ssh/config?我们不能在服务器端做这个吗?
    猜你喜欢
    • 2012-09-10
    • 2018-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-07
    • 1970-01-01
    • 2012-10-18
    相关资源
    最近更新 更多