Push to GitHub:could not resolve host: github.com
Posted 箫声远
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Push to GitHub:could not resolve host: github.com相关的知识,希望对你有一定的参考价值。
系统: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中添加一行如下:
192.30.252.128 github.com
解决方式2:
以root权限执行如下python代码
1 #!/usr/bin/python 2 #coding=utf8 3 4 import socket 5 6 host = ‘github.com‘ 7 8 try: 9 with open(‘/etc/hosts‘, ‘a+‘) as fp: 10 ip = socket.gethostbyname(host) 11 fp.write(‘ ‘.join([ip, host, ‘\n‘])) 12 except BaseException as e: 13 print(e) 14 else: 15 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的主要内容,如果未能解决你的问题,请参考以下文章
错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )(代码
错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read | 使用命令行提交代码 )(代码
错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )(代码
错误记录Android Studio 向 GitHub 提交代码报错 ( Push failed: Failed with error: Could not read from remote )(代码
IDEA用github提交Could not resolve host: github.com的解决方案
(诊断)为GitHub添加SSH key时出现“Could not open a connection to your authentication agent”错误的应对方案(转)