简体   繁体   English

无法在 EC2 iNSTANCE 上克隆 git repo

[英]Cannot clone git repo un EC2 iNSTANCE

I used the following command and tried to clone a repo but unfortunately the following error pops up.我使用了以下命令并尝试克隆一个 repo,但不幸的是弹出了以下错误。 I cannot go further我不能走得更远

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无法解析主机

This must be due to DNS issue on your EC2 instance (I can see that you're using Ubuntu here)这一定是由于您的 EC2 实例上的 DNS 问题(我可以看到您在这里使用的是 Ubuntu)

  1. You can try to use curl to test the connection to that URL first您可以先尝试使用curl来测试与该 URL 的连接
  2. Check the DNS configuration: cat /etc/resolv.conf检查 DNS 配置: cat /etc/resolv.conf
  3. If possible, you should replace your current DNS setting with others DNS like google (8.8.8.8 & 8.8.4.4)如果可能,您应该将当前的 DNS 设置替换为其他 DNS,例如google (8.8.8.8 & 8.8.4.4)
  4. Try to edit that file: vi /etc/resolv.conf尝试编辑该文件: vi /etc/resolv.conf
  5. You should insert/edit the following into:您应该将以下内容插入/编辑到:
    nameserver 8.8.8.8名称服务器 8.8.8.8
    nameserver 8.8.4.4名称服务器 8.8.4.4
  6. Save the file by clicking [Esc] and type :wq单击[Esc]并键入:wq保存文件

I fixed the problem once I added the following to my outbound connection for my group security setting:一旦我将以下内容添加到我的组安全设置的出站连接中,我就解决了这个问题:

Type: All traffic
Protocol: All
ip: 0.0.0.0/0

This also fixed my sudo yum install issues too.这也解决了我的 sudo yum 安装问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM