系统: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. ASP.NET开发知识总结

    1.统一异常处理 某商城采用的异常处理方式,是全局统一捕捉,统一处理 思路: 一.定义异常过滤器    实现 MyExceptionFilter : FilterAttribute,IExceptio ...

  2. android SlidingDrawer

    SlidingDrawer把内容从屏幕上隐藏,允许用户拖动把手将内容显示到屏幕.SlidingDrawer可用于垂直或水平.它由两个视图组成的:handle,让用户拖拉的;content,连在hand ...

  3. 网络命令-nc(一)

    一直在linux环境下编程,但却没有用过nc命令,不过最近发现Netcat这个命令-nc,发现真的蛮强大的, 为了备忘,就写了这个博客吧,不求全,只求把自己觉得很有用的命令整理出来,这篇文章估计要长期 ...

  4. BootStrap 轮播插件(carousel)支持左右手势滑动的方法(三种)

    原生的 Bootstrap 的 carousel.js 插件并没有支持手势,有下面3种解决方案 : 1. jQuery Mobile (http://jquerymobile.com/download ...

  5. python 装饰器 第一步:基本函数

    # 第一步:基本函数 def eat(): print('吃饭') # 调用 eat()

  6. Redis 系列

    Redis 系列 [Redis 系列(01)安装配制] [Redis 系列(02)数据结构] [Redis 系列(03-1)进阶 - 发布订阅] [Redis 系列(03-2)进阶 - 事务] [Re ...

  7. Web设计规范----控件、组件

    什么是控件?什么组件? 组件控件分类可以根据组件控件属性进行分类,也可以根据组件控件的功能进行划分.一般按功能划分,例如表单类就可以划分为:单文本输入,多文本输入.日历时间选择器.下拉选择列表.单选多 ...

  8. 试试监听输入框的值 (eq:在未输入前,按钮为灰色,输入内容后,按钮变蓝色)

    参考网址:https://blog.csdn.net/tel13259437538/article/details/78927071

  9. go语言从例子开始之Example1.helloworld

    Example: package main import "fmt" func main() { fmt.Println("hello world") } Re ...

  10. Python中dict的特点

    dict的第一个特点是查找速度快,无论dict有10个元素还是10万个元素,查找速度都一样.而list的查找速度随着元素增加而逐渐下降. 不过dict的查找速度快不是没有代价的,dict的缺点是占用内 ...