Linux可以上网但是出现未知的名称或服务
问题描述:我的网关都通,并且我物理机能够正常上网,说明我虚拟机DNS指向可能有问题。RedHat 8 git clone url时出现未知的名称或服务首先通过ssh -T git@github.com判断是否网络问题[huislee@huislee gitWorkspace]$ git clone git@github.com:huislee/study.git正克隆到 'study'...ssh
·
问题描述:
我的网关都通,并且我物理机能够正常上网,说明我虚拟机DNS指向可能有问题。
RedHat 8 git clone url时出现未知的名称或服务
首先通过ssh -T git@github.com判断是否网络问题
[huislee@huislee gitWorkspace]$ git clone git@github.com:huislee/study.git
正克隆到 'study'...
ssh: Could not resolve hostname github.com: Name or service not known
fatal: 无法读取远程仓库。
请确认您有正确的访问权限并且仓库存在。
[huislee@huislee gitWorkspace]$ ssh -T git@github.com
ssh: Could not resolve hostname github.com: Name or service not known
[huislee@huislee gitWorkspace]$ ping github.com
ping: github.com: 未知的名称或服务
[huislee@huislee gitWorkspace]$ ping git@github.com
ping: git@github.com: 未知的名称或服务
查看/etc/resolv.conf发现没有配置;因此我就静态添加了DNS
vi /etc/resolv.conf
然后把下面三条记录复制进去
search localdomain
nameserver 8.8.8.8
nameserver 8.8.4.4
[root@huislee gitWorkspace]# cat /etc/resolv.conf
# Generated by NetworkManager
[root@huislee gitWorkspace]# vi /etc/resolv.conf
[root@huislee gitWorkspace]# ping baidu.com
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=49 time=25.2 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=49 time=25.1 ms
[root@huislee gitWorkspace]# 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=1 ttl=47 time=101 ms
64 bytes from ec2-13-229-188-59.ap-southeast-1.compute.amazonaws.com (13.229.188.59): icmp_seq=2 ttl=47 time=101 ms
64 bytes from ec2-13-229-188-59.ap-southeast-1.compute.amazonaws.com (13.229.188.59): icmp_seq=3 ttl=47 time=117 ms
[huislee@huislee gitWorkspace]$ git clone git@github.com:huislee/study.git
正克隆到 'study'...
The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 677 (delta 1), reused 7 (delta 1), pack-reused 669
接收对象中: 100% (677/677), 85.08 MiB | 291.00 KiB/s, 完成.
处理 delta 中: 100% (138/138), 完成.
正在检出文件: 100% (643/643), 完成.
[huislee@huislee gitWorkspace]$
完成克隆远程库到本地 且可以ping通百度等。
更多推荐
已为社区贡献5条内容
所有评论(0)