【问题标题】:git push -u origin main fatal: unable to accessgit push -u origin main 致命:无法访问
【发布时间】:2021-06-08 08:47:41
【问题描述】:

我已经在我的笔记本电脑上安装了 git-bash,并试图将我的项目推送到我的 GitHub 帐户上,但它显示了这个:

$ git push -u origin main fatal: unable to access 'https://github.com/user_name/repo_name.git/': 
Could not resolve host: github.com

我已多次尝试该命令并检查其他内容。有时我发现,这个命令让 bash 屏幕卡住了,什么也没做。 -_-

我已经试过这个命令来确保遥控器是正确的:

$ git remote -v

然后得到这个:

origin  https://github.com/user_name/repo_name.git (fetch)
origin  https://github.com/user_name/repo_name.git (push)

我在 git config 中检查了我的用户名和电子邮件:

$ git config user.email
$ git config --global user.password

发现所有这些东西我都试过了。

【问题讨论】:

  • 您的电脑无法解析主机github.com
  • 这似乎是网络问题

标签: git github


【解决方案1】:

如果您在代理后面,您可能需要定义 HTTP_PROXY/HTTPS_PROXY 环境变量,如 I did here
或者相反:你在 Git 中指定了错误的代理:

git config --global --unset https.proxy

或者,根据您的情况:

【讨论】:

    猜你喜欢
    • 2021-04-13
    • 2011-08-07
    • 2020-07-30
    • 2023-02-02
    • 2020-11-23
    • 2018-07-30
    • 2021-12-10
    • 2021-10-19
    • 1970-01-01
    相关资源
    最近更新 更多