System: Mac OS X 10.11.3
Action: Push to GitHub
The error is as follows:
Git push origin
Ssh:could not resolve hostname ssh.github.com:Name or service not known
Fatal:could not read from remote repository.
Sure you have the correct access rights
and the repository exists.
Make: * [deploy] Error 128
Workaround 1:
Step1. Ping github.com
Get the IP to github.com to 192.30.252.128
Step2. Add a line to the/etc/hosts as follows:
192.30.252.128 github.com
Workaround 2:
Execute the following Python code with root privileges
1 #!/usr/bin/python2 #Coding=utf83 4 ImportSocket5 6Host ='github.com'7 8 Try:9With open ('/etc/hosts','A +') as FP:TenIP =Socket.gethostbyname (host) OneFp.write (' '. join ([IP, Host,'\ n'])) A exceptbaseexception as E: - Print(e) - Else: the Print('sucess')
Special: Some friends can't find /etc/hosts .
Reference method:
First step: Please open the Finder app in your MAC system first,
The second step: Please press the shortcut key combination shift+command+g three combination keys, and enter the path of the Hosts file:/etc/hosts,
Step three: You can then see the Hosts file in the Finder window,
The fourth step: copy out the changes and drag back the cover to take effect, the success, to enjoy the push bar.
Pay tribute to the original, I have just encountered this problem, collated and shared to everyone.
http://blog.csdn.net/piaotiejun/article/details/48734175
Push to Github:could not resolve host:github.com