【问题标题】:git clone via git@github.com:xxx/yyy.git in company network通过公司网络中的 git@github.com:xxx/yyy.git 进行 git 克隆
【发布时间】:2020-12-21 09:13:27
【问题描述】:

我将我的公钥添加到 github 并尝试使用克隆

git clone git@github.com:xxx/yyy.git

git clone https://github.com/xxx/yyy.git

在我的 私人 计算机上的 git bash 中。一切正常,但在我的计算机上,连接到 公司网络 我只能通过 git bash 中的 https 进行克隆。对于 ssh,我收到以下错误

ssh:无法解析主机名 github.com:名称或服务未知 致命:无法从远程存储库读取。

我检查了 ~/.ssh 文件夹,我认为一切都是正确的。我也试过了

git clone git@192.30.255.112:xxx/yyy.git 

没有成功。也在其他论坛/问题中搜索但没有成功。

有人知道这个问题的解决方案/解决方法吗?

谢谢!

【问题讨论】:

    标签: git ssh git-bash


    【解决方案1】:

    生成 ssh 密钥并将其添加到 Github。 https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

    但如果您的公司使用代理,您需要使用该命令告诉 git:git config --global http.proxy http://proxyUsername:'proxypassword'@proxy.server.com:port

    【讨论】:

    猜你喜欢
    • 2016-11-20
    • 1970-01-01
    • 2012-03-01
    • 1970-01-01
    • 2014-12-06
    • 2014-02-26
    • 1970-01-01
    • 2023-01-11
    • 1970-01-01
    相关资源
    最近更新 更多