首页 > 解决方案 > WSL 中的 Git 命令有时无法解析 URL

问题描述

我的 windows10 机器中的 WSL 有时无法解析某些 URL。

观察到执行 git 命令时出现问题。主要是这样的命令:

git pull --ff-only
git push 

它无法从 github.com 和 go.googlesource.com 拉取。但 ping 正常工作:

ping go.googlesource.com

推送到 Azure DevOps(通过 ssh)时也会失败。错误显示:

ssh: Could not resolve hostname ssh.dev.azure.com: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

重要的:

此问题仅在某些时候出现。当 git push 尝试 azure devops 失败时,重试 2-3 次后,第四次推送成功。

有人可以帮我解决这个问题吗?

标签: gitwindows-10windows-subsystem-for-linuxresolve

解决方案


推荐阅读