无法克隆 git repo un EC2 iNSTANCE
Cannot clone git repo un EC2 iNSTANCE
我使用了以下命令并尝试克隆一个存储库,但不幸的是弹出了以下错误。我不能再进一步了
ubuntu@ip-add-rr-ee-ss:~$ git clone https://github.com/repo/file.git
Cloning into 'file'...
fatal: unable to access 'https://github.com/repo/file.git/': Could not resolve host: github.com
Could not resolve host
这一定是由于您的 EC2 实例上的 DNS 问题(我可以看到您在这里使用 Ubuntu)
- 您可以先尝试使用
curl
测试与 URL 的连接
- 检查 DNS 配置:
cat /etc/resolv.conf
- 如果可能的话,你
应该将您当前的 DNS 设置替换为其他 DNS,例如 google
(8.8.8.8 & 8.8.4.4)
- 尝试编辑该文件:
vi /etc/resolv.conf
- 你
应 insert/edit 以下内容:
名称服务器 8.8.8.8
名称服务器 8.8.4.4
- 点击
[Esc]
并输入 :wq
保存文件
我将以下内容添加到组安全设置的出站连接后,我就解决了这个问题:
Type: All traffic
Protocol: All
ip: 0.0.0.0/0
这也解决了我的 sudo yum 安装问题。
我使用了以下命令并尝试克隆一个存储库,但不幸的是弹出了以下错误。我不能再进一步了
ubuntu@ip-add-rr-ee-ss:~$ git clone https://github.com/repo/file.git
Cloning into 'file'...
fatal: unable to access 'https://github.com/repo/file.git/': Could not resolve host: github.com
Could not resolve host
这一定是由于您的 EC2 实例上的 DNS 问题(我可以看到您在这里使用 Ubuntu)
- 您可以先尝试使用
curl
测试与 URL 的连接 - 检查 DNS 配置:
cat /etc/resolv.conf
- 如果可能的话,你 应该将您当前的 DNS 设置替换为其他 DNS,例如 google (8.8.8.8 & 8.8.4.4)
- 尝试编辑该文件:
vi /etc/resolv.conf
- 你
应 insert/edit 以下内容:
名称服务器 8.8.8.8
名称服务器 8.8.4.4 - 点击
[Esc]
并输入:wq
保存文件
我将以下内容添加到组安全设置的出站连接后,我就解决了这个问题:
Type: All traffic
Protocol: All
ip: 0.0.0.0/0
这也解决了我的 sudo yum 安装问题。