问题描述

今天早上在自己的虚拟机上用git pull命令更新github上的版本库时提示下面的错误

[root@localhost ~] git clone git@github.com:sdscbr/demos.git
正克隆到 'demos'...
ssh: Could not resolve hostname github.com: Name or service not known
fatal: 无法读取远程仓库。 请确认您有正确的访问权限并且仓库存在。

我的本地虚拟机的系统是centos7,我以为是ssh秘钥的问题,于是我重新生成ssh秘钥并且与github进行关联,关联之后又试了一下,还是提示上面的错误,然后我ping了一下github.com和www.baidu.com

[root@localhost ~]# ping www.baidu.com
ping: www.baidu.com: 未知的名称或服务
[root@localhost ~]# ping github.com
ping: github.com: 未知的名称或服务

看来不是ssh秘钥的原因,那是什么原因呢?

解决办法

于是我想到了是不是前几天刚把动态IP换成静态IP的原因,那就试一下吧,打开

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="static"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="bde91a49-d394-4b97-9657-61c530abf4f4"
DEVICE="ens33"
ONBOOT="yes"
ZONE=public
IPADDR=192.168.142.131

将上面的BOOTPROTO="static"修改为BOOTPROTO="dhcp",动态获取ip,同时去掉IPADDR=192.168.142.131,再重启network服务

# 修改成现在的
TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"
BOOTPROTO="dhcp"
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="ens33"
UUID="bde91a49-d394-4b97-9657-61c530abf4f4"
DEVICE="ens33"
ONBOOT="yes"
ZONE=public # 重启network服务
[root@localhost ~]# systemctl restart network

最后再试一下ping和git pull,都恢复正常了_

ssh: Could not resolve hostname github.com: Name or service not known的更多相关文章

  1. git提示错误关于错误:ssh: Could not resolve hostname github.com: Name or service not known.fatal: Could not read from remote repository.

    关于 Git 使用中出现的错误 饥人谷_楠柒 关注 2016.11.02 15:33* 字数 746 阅读 3607评论 5喜欢 10赞赏 1 关于错误:ssh: Could not resolve ...

  2. mac 配置 ssh 到git (Could not resolve hostname github.com, Failed to connect to github.com port 443 Operation timed out)

    1.进入终端命令行 (1)输入:cd .ssh/ 进入到.ssh后,输入ls,会输出“known_hosts”,如果没有创建过rsa的话 (2)输入:man ssh-add (3)输入:ssh-key ...

  3. ssh: Could not resolve hostname问题终于解决了?

    1.如果系统为64位,无法启动启动hdfs: ./sbin/start-dfs.sh.并有以下错误: sed: -e expression #1, char 6: unknown option to  ...

  4. git错误--ssh: Could not resolve hostname ssh.github.com: Name or service not known--解决方式

    错误如下: git push origin ssh: Could not resolve hostname ssh.github.com: Name or service not known fata ...

  5. ssh: Could not resolve hostname gitcafe.com: nodename nor servname provided, or not known

    今天 git push 的时候报如下错误: ssh: Could not resolve hostname gitcafe.com: nodename nor servname provided, o ...

  6. ssh: Could not resolve hostname git.*****-inc.com : Temporary failure in name resolution fatal: The remote end hung up unexpectedly

    问题出现的情景:使用git pull拉取开发的代码到测试服务器,报错: ssh: Could not resolve hostname git.****-inc.com : Temporary fai ...

  7. hadoop启动报错:localhost: ssh: Could not resolve hostname localhost

    hadoop启动journalnode时报错:localhost: ssh: Could not resolve hostname localhost: Temporary failure in na ...

  8. hadoop启动时,报ssh: Could not resolve hostname xxx: Name or service not known

    本文转载自:http://blog.csdn.net/wodewutai17quiet/article/details/76795951 问题:hadoop启动时,报ssh: Could not re ...

  9. linux-解决/usr/bin/which: no ssh-copy-id in 和ssh: Could not resolve hostname问题

    使用yum install openssh-clients  安装命令 有的系统没有此命令 有的系统缺省 就包含这一条命令! 但是我的测试机没有发现此命令 只能这样安装! 这时有报错了 1 2 [ro ...

随机推荐

  1. 2019年开发App记录

    Pod 制作私有库参考 https://www.jianshu.com/p/f903ecf8e882 Pod私有库的升级 改代码部分,到Example文件夹执行pod install ,修改XXX.s ...

  2. Kohana Cache

    The default cache group is loaded based on the Cache::$default setting. It is set to the file driver ...

  3. 长链剖分优化树形DP总结

    长链剖分 规定若\(x\)为叶结点,则\(len[x]=1\). 否则定义\(preferredchild[x]\)(以下简称\(pc[x]\),称\(pc[x]\)为\(x\)的长儿子)为\(x\) ...

  4. loadrunner性能测试巧匠训练营-controller

    1.设置集合点 现在脚本添加集合点的函数,集合点不能添加到事务里面,负责统计事务的时候会把时间计算进去 2.IP欺骗 前言 https://www.cnblogs.com/danbing/p/7459 ...

  5. [CSP-S模拟测试]:随(快速幂+数学)

    题目描述 给出$n$个正整数$a_1,a_2...a_n$和一个质数mod.一个变量$x$初始为$1$.进行$m$次操作.每次在$n$个数中随机选一个$a_i$,然后$x=x\times a_i$.问 ...

  6. leetcode-mid-array-3 Longest Substring Without Repeating Characters

    mycode  99.21% class Solution(object): def lengthOfLongestSubstring(self, s): """ :ty ...

  7. create react app的 css loader 进行局部配置

    { test: cssRegex, exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, sourceMap: isEnv ...

  8. 013-Spring Boot web【二】静态资源、Servlet、Filter、listenter

    一.静态资源 1.1.webapp默认支持静态资源 在src/main/webapp下建立user.html默认支持访问 1.2.默认内置静态资源目录.可被直接访问 查看包:spring-boot-a ...

  9. vts测试流程

    测试前提: 1.发货user版本 2.selinux:Enable 3.连接ADB,stay awake 4.烧录XXX申请的key 5.外网环境(ipv6) ATV9测试准备(正常准备环境+fast ...

  10. 【Unity Shader】---准确认识SubShader语义块结构、渲染状态设定、Tags标签

    一[SubShader] 每个UnityShader文件可以包含多个SubShader语义块,但至少要有一个.当Unity需要加载这个UnityShader时,Unity会扫描所有的SubShader ...