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

时间: 2024-08-05 08:07:09

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

Could not resolve host:github.com

刚开始学git,在GitHub上新建了一个远程仓库,然后想clone到本地,然后就出现“Could not resolve host:github.com“这个问题,网上找了一下解决方法: 编辑/etc/resolv.conf文件,增加下面内容: nameserver 8.8.8.8 或者 nameserver 114.114.114.114 之后再用git clone 就可以把远程仓库clone到本地了

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

问题:[[email protected] ~]# yum -y install gcc-*Loaded plugins: fastestmirror, prestoCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.cent

cents上执行wget报错:unable to resolve host address

wget命令报错,无法解析域名"www.keepalived.rog" [[email protected] download]$ wget http://www.keepalived.org/software/keepalived-1.2.12.tar.gz --2014-05-05 11:06:14--  http://www.keepalived.org/software/keepalived-1.2.12.tar.gz Resolving www.keepalived.org.

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

问题:[[email protected] ~]# yum -y install gcc-*Loaded plugins: fastestmirror, prestoCould not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.cent

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

假设git例如,下面的问题时,远程推送: [[email protected] learngit]$ git push -u origin master ssh: connect to host github.com port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the reposit

Couldn't resolve host 'mirrorlist.centos.org'解决办法

今天在服务器上安装oneinstack时, 输入命令: wget http://mirrors.linuxeye.com/oneinstack-full.tar.gz 出现: Couldn't resolve host 'mirrorlist.centos.org' 无法解析 解决方法: [[email protected] ~]# vim /etc/resolv.conf nameserver 8.8.8.8 就好了. 不要怕问题,所有的问题,都是让你收获答案来的. ----------  招

"Could not resolve host: mirrorlist.centos.org; Unknown error"解决方法

这两天学习历程可谓历尽坎坷,昨天在vSphere Client中安装完CentOS系统后,今天尝试在系统中安装mysql数据库. 由于刚接触Linux,所以对于一些常用指令和操作并不熟悉,也是一边百度一边操作的,所以对照博文进行mysql在线安装: wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz 回车确认时出现第一个问题:bash:wget:command not

github默认端口22被占用,ssh: connect to host github.com port 22: Connection timed out

出现github 连接错误: ssh:connect to host github.com port 22:Connection timed out 刚开始以为是网络问题,github不能连接上,但是使用ssh命令,用端口443测试发现可以连接上github ssh -T -p 443 [email protected] Enter passphrase for key '/root/.ssh/id_rsa': Hi yinfei1! You've successfully authentica

一组相关联的问题:“sudo: unable to resolve host ###: Connection timed out”、软件启动速度超慢、IPv6无法使用

近日陆续发现计算机出现几个问题,最终发现这些问题实际上是由同一个原因导致的 问题1:无法使用IPv6 问题2:无论是启动Emacs GUI还是在命令行中执行emacs -nw指令,打开Emacs的时间很长,且提示"sudo: unable to resolve host ###: Connection timed out" 问题3:打开/etc/hosts时提示文件正在被使用无法显示文件内容 解决方法:在/etc/hosts中,增加一行"127.0.1.1 ###"