gpt4 book ai didi

git 克隆需要 ssh ://protocol when perhaps it shouldn't?

转载 作者:太空狗 更新时间:2023-10-29 12:52:26 25 4
gpt4 key购买 nike

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

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

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

这是预期的 git 行为吗?为什么第一个 url 不起作用但第二个 url 起作用?

最佳答案

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

关于git 克隆需要 ssh ://protocol when perhaps it shouldn't?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3366718/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com