git 致命错误:无法解析主机 github.com

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33667782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:41:47  来源:igfitidea点击:

Fatal Error : Can't resolve host github.com

gitgithubgithub-for-windows

提问by Vini

I am trying to push files to my remote repository from my local repository and I see this

我正在尝试将文件从我的本地存储库推送到我的远程存储库,我看到了这个

fatal error : fatal: unable to access 'https://github.com/vinivasundharan/abcd.git/': Couldn't resolve host 'github.com'

致命错误:致命:无法访问“ https://github.com/vinivasundharan/abcd.git/”:无法解析主机“github.com”

My computer is not using any Proxy because I have seen methods to resolve the issue when Proxy is being used.

我的计算机没有使用任何代理,因为我已经看到了在使用代理时解决问题的方法。

I have tried the solutions from thisand this. But both doesn't seem to help. My system has an active internet connection using Windows 7.

我已经尝试过thisthis的解决方案。但两者似乎都没有帮助。我的系统具有使用 Windows 7 的活动互联网连接。

UPDATE

更新

git config -lreturns the following. I had to post it because I do not what exaclty this means

git config -l返回以下内容。我不得不发布它,因为我不知道这意味着什么

core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
http.sslcainfo=C:/Users/vav9sw/AppData/Local/Programs/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
user.name=xyz
[email protected]
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=https://github.com/vinivasundharan/abcd.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*`

EDIT

编辑

Just to make sure that i have followed the steps to Upload the file to GitHub check the attached image to see the steps i have followed.

只是为了确保我已按照将文件上传到 GitHub 的步骤检查所附图片以查看我已遵循的步骤。

steps

脚步

回答by Ranvijay Sachan

This solved my problem:

这解决了我的问题:

http version:

git config --global --unset http.proxy

https version:

git config --global --unset https.proxy

回答by hjpotter92

In Windows, if you've any third party firewall (or internet activity monitor) installed, then configure them to allow your client to access outside connection.

在 Windows 中,如果您安装了任何第三方防火墙(或 Internet 活动监视器),则将它们配置为允许您的客户端访问外部连接。

If there aren't any 3rd part firewallls, then go to control panel, search for firewall. Inside the firewall panel, select Add a new exception(or similar option). Allow the git client both inbound and outbound access.

如果没有任何第三部分 firewallls,则转到控制面板,搜索防火墙。在防火墙面板内,选择添加新例外(或类似选项)。允许 git 客户端入站和出站访问。

回答by GintsGints

I recomend you to switch to ssh.

我建议你切换到 ssh。

You can get github ssh link from same place where https one. Then you just have to generate/add your ssh key to github profile. And that's it.

您可以从 https 的同一个地方获得 github ssh 链接。然后你只需要生成/添加你的 ssh 密钥到 github 配置文件。就是这样。