系统:Mac os x 10.11.3

操作:Push to GitHub

错误如下: 
git push origin 
ssh: Could not resolve hostname ssh.github.com: Name or service not known 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights 
and the repository exists. 
make: * [deploy] 错误 128

解决方式1: 
step1. ping github.com 
获取到github.com的ip为192.30.252.128 
step2. 在/etc/hosts(可以通过shift+command+g快速跳转)中添加一行如下: 
192.30.252.128 github.com

解决方式2: 
以root权限执行如下python代码

 #!/usr/bin/python
#coding=utf8 import socket host = 'github.com' try:
with open('/etc/hosts', 'a+') as fp:
ip = socket.gethostbyname(host)
fp.write(' '.join([ip, host, '\n']))
except BaseException as e:
print(e)
else:
print('sucess')

特别的:部分朋友找不到/etc/hosts

参考办法:

第一步:请先打开 Mac 系统中的 Finder 应用,

第二步:请按快捷键组合 Shift+Command+G 三个组合按键,并输入 Hosts 文件的所在路径:/etc/hosts,

第三步:随后即可在 Finder 窗口中看到 Hosts 文件了,

第四步:拷贝出来修改后拖回覆盖即可生效,就此成功,去尽情的push吧。

向原者致敬,我刚才碰到这个问题,整理分享给大家。

http://blog.csdn.net/piaotiejun/article/details/48734175

Push to GitHub:could not resolve host: github.com的更多相关文章

  1. could not resolve host: github.com 问题解决办法

    向github提交代码时出现问题,如图: 代码push失败,提示could not resolve host: github.com     解决办法:   1.打开终端,输入:ping github ...

  2. 修改ubuntu DNS的步骤/wget url报错: unable to resolve host address的解决方法

    wget url 报错:unable to resolve host address ‘url’,显然是无法解析主机地址,这就能看出是DNS解析的问题.解决办法就是配置可用的dns 一般是修改成为谷歌 ...

  3. 关于github报错:ssh: connect to host github.com port 22: Connection timed outfatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.

    当执行git命令如:git clone.git pull等等 出现报错:ssh: connect to host github.com port 22: Connection timed outfat ...

  4. linux安装软件时提示找不到镜像的问题:Couldn't resolve host 'mirrorlist.centos.org'

    问题:[root@cddserver2 ~]# yum -y install gcc-*Loaded plugins: fastestmirror, prestoCould not retrieve ...

  5. cents上运行wget报错:unable to resolve host address

    wget命令报错.无法解析域名"www.keepalived.rog" [vagrant@RS1 download]$ wget http://www.keepalived.org ...

  6. oracle linux 7 yum报错解决:COULD NOT RESOLVE HOST: YUM.ORACLE.COM

    虚拟机中yum报错 [root@localhost ~]# yum -y install oracle-rdbms-server-11gR2-preinstall Loaded plugins: la ...

  7. git 出现错误 Could not resolve host: github.com 或者 gitlab.com 或者gerrit相关( 自有服务 )

    原来是因为github.com没有被主机给解析 1.第一步是 ping 你的gitlab 或者 github服务器ip地址 如果每隔几秒有 time = xx.ms 刷新 就证明是通的 2. 编辑 e ...

  8. ssh: connect to host github.com port 22: Connection refused

    假设git例如,下面的问题时,远程推送: [fulinux@ubuntu learngit]$ git push -u origin master ssh: connect to host githu ...

  9. ssh: connect to host github.com port 22: Connection timed out

    问题描述 $ git clone git@github.com:MaugerWu/MaugerWu.github.io.git Cloning into 'MaugerWu.github.io'... ...

随机推荐

  1. Python 进阶_迭代器 & 列表解析

    目录 目录 迭代器 iter 内建的迭代器生成函数 迭代器在 for 循环中 迭代器与字典 迭代器与文件 创建迭代器对象 创建迭代对象并实现委托迭代 迭代器的多次迭代 列表解析 列表解析的样例 列表解 ...

  2. Php邮件发送源码

    好久冒写点东西了.....最近生活压抑的很....为生活而劳累,整理下邮件发送的实例了,网上也有很多,我这个也是提取整理好的,测试Ok,首页邮件类smtp_email_class.php如下:< ...

  3. SpringMVC上传文件的三种方式(转帖)

    /* * 通过流的方式上传文件 * @RequestParam("file") 将name=file控件得到的文件封装成CommonsMultipartFile 对象 */ @Re ...

  4. VINS 估计器之优化与边缘化

    VINS的优化除了添加了投影残差,回环检测残差,还有IMU的残差,边缘化产生的先验信息残差等.有些比较难理解,可参考此博客和知乎回答. void Estimator::optimization() { ...

  5. Javascript基础四(数组,字符,对象,日期)

    第一节:数组 1.数组的概念及定义     可以存放一组数据:          当需要操作多个数据时: 2.数组的创建方式 var arr1 = [1,2,3]; //字面量方式 var arr2 ...

  6. 图形设计 X11

    显示适配器驱动程序安装范例 AMD驱动加载 Intel驱动加载

  7. common-dbcp2数据库连接池参数说明(转)

    转自:http://bsr1983.iteye.com/blog/2092467 由于commons-dbcp所用的连接池出现版本升级,因此commons-dbcp2中的数据库池连接配置也发生了变化, ...

  8. 力扣 ——4Sum (四数之和)python 实现

    题目描述: 中文: 给定一个包含 n 个整数的数组 nums 和一个目标值 target,判断 nums 中是否存在四个元素 a,b,c 和 d ,使得 a + b + c + d 的值与 targe ...

  9. CSS 3D 的魅力

    作者 | 子慕大诗人 来源 | www.cnblogs.com/1wen/p/9064011.html   前言:   最近玩了玩用css来构建3D效果,写了几个demo,所以博客总结一下.  在阅读 ...

  10. python基础--逻辑运算

    #and or not#and 且 :两边都为真才是真#or 或:一个真就是真(一真为真)#ont 非:相反#优先级:1.not>and>or#同一优先级由左向右以此计算!#列子:prin ...