【问题标题】:PyCharm IDE Connecting to GitHub RepoPyCharm IDE 连接到 GitHub 存储库
【发布时间】:2019-08-09 10:51:23
【问题描述】:

我正在尝试将一些代码推送到 GitHub 的存储库中,但是在按照 PyCharm 的文档设置 Remotes、将目录设置为存储库并将 ssh 可执行文件 设置为 “内置”(在版本控制设置上),我收到以下错误:

  dnb_api: ssh: Could not resolve hostname github.com: Name or service not known Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

奇怪的是:repo 确实存在,并且连接的链接是 SSH 形式:“git@github.com:user/repo.git”

请务必注意,我使用的是公司代理,但所有代理设置均已正确配置(因为我可以安装软件包并连接外部 API)。 就连

  'git config --global http.proxy <username>:<password>@proxy:port' 

  'git config --global https.proxy <username>:<password>@proxy:port'

在命令行中正确配置的位置。

你知道如何解决这个问题吗?

【问题讨论】:

    标签: git github pycharm git-push


    【解决方案1】:

    首先,SSH 不需要设置代理:所述代理将用于 HTTPS 连接。

    其次,在命令行中再次检查 ssh -Tv git@github.com 是否有效(请参阅“Testing your SSH connection”:所以您会看到欢迎消息?)。
    我对企业客户所做的任何任务都涉及到 SSH 被客户端代理阻止

    OPPetter Mendes 表示:

    我用 Git 的令牌更新了 Windows 凭据,现在它可以工作了....

    这意味着:

    • URL 是 HTTPS 的,而不是 SSH 的
    • GitHub 帐户已激活 2FA,在这种情况下,只有令牌可用作密码。

    【讨论】:

    • 好吧,我尝试连接但出现了$ ssh -Tv git@github.com OpenSSH_7.7p1, OpenSSL 1.0.2o 27 Mar 2018 debug1: Reading configuration data /etc/ssh/ssh_config ssh: Could not resolve hostname github.com: Name or service not known 。我认为这是由于我的/ssh/文件位置和/或公司代理。无论如何,我也尝试过ssh -Tv git@github.com "ProxyCommand nc -proxy &lt;username&gt;:&lt;password&gt;@proxy:port %h %p",但没有成功......
    • 是的,这与任何传出 SSH 连接被阻止是一致的,这一直是我迄今为止看到的企业客户端的策略。
    • @Petter_Mendes 太好了!我已经相应地更新了答案。
    • 非常感谢!尽管您没有指出该程序 (Windows Credentials),但它为关注其他可能性铺平了道路。
    • @Petter_Mendes 我没有指出 Windows 凭据(我非常清楚:stackoverflow.com/a/48838624/6309),因为您在问题中提到了 SSH URL。
    猜你喜欢
    • 2020-10-30
    • 2017-04-22
    • 1970-01-01
    • 1970-01-01
    • 2014-02-03
    • 1970-01-01
    • 2017-12-08
    • 2013-01-20
    • 1970-01-01
    相关资源
    最近更新 更多