所以基本上我有一个服务器,我有bitbucket git存储库设置.我已经使用它几个月了,现在我试图拉动蓝天,我得到以下错误:
ssh: Could not resolve hostname bitbucket.org: 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.
Run Code Online (Sandbox Code Playgroud)
我100%确定我已经正确设置了我的ssh-keys.
git remote -v
origin git@bitbucket.org:marel/tshirtmafia.git (fetch)
origin git@bitbucket.org:marel/tshirtmafia.git (push)
Run Code Online (Sandbox Code Playgroud)
有任何建议如何解决这个问题?如果您还有其他需要,请告诉我.
sza*_*sky 27
此问题是由不正确的git配置引起的.在项目的根文件夹中打开.git文件夹,在配置文件中找到以.开头的行
url = git@bitbucket.org
很可能你在那里指定了协议并定义了url,如url = ssh://git@bitbucket.org
删除ssh://它应该为你做的伎俩.
sre*_*mar 21
这对我有用.我在NetworkPreference中添加了Google DNS服务器详细信息.
将 bitbucket.org 添加到您的主机文件
nano /etc/hosts
Run Code Online (Sandbox Code Playgroud)
将 bitbucket.org 添加到主机文件中,如下所示
104.192.143.1 bitbucket.org
Run Code Online (Sandbox Code Playgroud)
保存文件并退出。bitbucket 应该解决。
我不知道这个问题的确切原因.首先要ping bitbucket.org.如果您收到回复,请按照以下步骤操作.
转到你repo的.git文件夹,使用你最喜欢的editor.open 配置 文件并更改url值,如下所示.为我工作.
https://bitbucket.org/<username>/<repo> -> https://<username>@bitbucket.org/<username>/<repo>
Run Code Online (Sandbox Code Playgroud)
相同的步骤也将修复ssh问题,只需添加用户名.
小智 6
有些答案提到了编辑/etc/hosts
。它对我不起作用,但引导我解决问题。
我正在安装全新的 WSL/Ubuntu,并尝试克隆我的存储库。我收到了与 OP 完全相同的错误消息。此外,我在 ping google.com 时也会遇到类似的错误,但我可以 ping 8.8.8.8 就好。
解决方案:编辑/etc/resolv.conf
默认名称服务器并将其替换为 8.8.8.8。
该错误消息表明存在 DNS 或网络问题。如果这是一个 Linux 机器,您可以研究一些网络命令的输出,例如ifconfig
、host bitbucket.org
、 ,并遵循一些针对您的特定环境解决 DNS 问题的指南。