博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
fatal: unable to access ‘https://github.com/***/***.git/‘: Could not resolve host:github.com
阅读量:2119 次
发布时间:2019-04-30

本文共 1530 字,大约阅读时间需要 5 分钟。

在克隆代码是出现访问不到github的情况

比如:

git clone https://github.com/WongKinYiu/PyTorch_YOLOv4.git

Cloning into ‘PyTorch_YOLOv4’…

fatal: unable to access ‘https://github.com/WongKinYiu/PyTorch_YOLOv4.git/’: Could not resolve host: github.com

打开终端,输入:

ping github.com

PING github.com (13.229.188.59) 56(84) bytes of data.

64 bytes from ec2-13-229-188-59.ap-southeast-1.compute.amazonaws.com (13.229.188.59): icmp_seq=2 ttl=44 time=278 ms
64 bytes from ec2-13-229-188-59.ap-southeast-1.compute.amazonaws.com (13.229.188.59): icmp_seq=3 ttl=44 time=279 ms
64 bytes from ec2-13-229-188-59.ap-southeast-1.compute.amazonaws.com (13.229.188.59): icmp_seq=4 ttl=44 time=284 ms

括号中的地址13.229.188.59就是github.com的实际地址.

将地址设置到配置文件:

sudo gedit /etc/hosts

原本的内容:

127.0.0.1	localhost127.0.1.1	ubun# The following lines are desirable for IPv6 capable hosts::1     ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allrouters

13.229.188.59 github.com写到里面:

127.0.0.1	localhost127.0.1.1	ubun13.229.188.59	github.com# The following lines are desirable for IPv6 capable hosts::1     ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allrouters

再次使用git clone

git clone https://github.com/WongKinYiu/PyTorch_YOLOv4.git

Cloning into ‘PyTorch_YOLOv4’…

remote: Enumerating objects: 507, done.
remote: Total 507 (delta 0), reused 0 (delta 0), pack-reused 507
Receiving objects: 100% (507/507), 1.19 MiB | 6.00 KiB/s, done.
Resolving deltas: 100% (269/269), done.

克隆代码成功

转载地址:http://glwrf.baihongyu.com/

你可能感兴趣的文章
leetcode 130. Surrounded Regions
查看>>
【托业】【全真题库】TEST2-语法题
查看>>
博客文格式优化
查看>>
【托业】【新托业全真模拟】疑难语法题知识点总结(01~05)
查看>>
【SQL】group by 和order by 的区别。
查看>>
【Python】详解Python多线程Selenium跨浏览器测试
查看>>
Jmeter之参数化
查看>>
Shell 和Python的区别。
查看>>
Python 列表(list)、字典(dict)、字符串(string)常用基本操作小结
查看>>
Loadrunner之https协议录制回放报错如何解决?(九)
查看>>
python中xrange和range的异同
查看>>
列表、元组、集合、字典
查看>>
【Python】easygui小甲鱼
查看>>
【Python】关于Python多线程的一篇文章转载
查看>>
【Pyton】【小甲鱼】文件
查看>>
【Pyton】【小甲鱼】永久存储:腌制一缸美味的泡菜
查看>>
【Pyton】【小甲鱼】异常处理:你不可能总是对的
查看>>
APP性能测试工具
查看>>
【Pyton】【小甲鱼】类和对象
查看>>
压力测试工具JMeter入门教程
查看>>