【问题标题】:Setting remote to use specified port for ssh将远程设置为使用指定端口进行 ssh
【发布时间】:2011-11-09 06:40:56
【问题描述】:

我已将 ssh 密钥设置为在指定端口(例如 12345)上工作,并发出以下 git 命令以在本地 repo 上设置源。

git remote add origin myusername@mydomain.com:12345/path/to/public_html/files/

当我尝试推送到原点时,我收到以下错误消息。

ssh: connect to host mydomain.com port 22: Connection refused
fatal: The remote end hung up unexpectedly

我如何设置来源以便它使用正确的 ssh 端口?

【问题讨论】:

标签: git


【解决方案1】:

要指定自定义端口,您必须添加 ssh:// 前缀。否则,git 会将您的 12345 解释为项目路径的一部分。见URLs in the git-pull docs。所以:

git remote add origin ssh://myusername@mydomain.com:12345/path/to/public_html/files/

【讨论】:

    猜你喜欢
    • 2015-03-16
    • 2018-05-28
    • 2021-05-11
    • 2021-07-02
    • 2017-01-22
    • 1970-01-01
    • 2011-02-26
    • 1970-01-01
    • 2021-06-06
    相关资源
    最近更新 更多