今天在使用git的時候執行將本地分支推送到遠程分支的push操作時(同時為遠程庫創建和本地分支同名的分支),遇到了超時的錯誤,經過查詢全網各位大牛的操作這里給出有效解決方式
進入C:\Windows\System32\drivers\etc目錄下找到hosts文件,以管理員身份運行后在文件尾插入下面兩行即可(這里推薦使用notepad文本編輯器,右鍵以管理員身份運行后直接打開host文件,完成修改后ctrl+s保存真方便呀,媽媽再也不用擔心我修改不了hosts文件了)
192.30.253.112 github.com
151.101.88.249 github.global.ssl.fastly.net
整個hosts的文件如下:
# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost #0.0.0.1 mssplus.mcafee.com 192.30.253.112 github.com 151.101.88.249 github.global.ssl.fastly.net
保存后重新打開cmd執行ping github.com即可ping通,關於git的推送超時的問題也迎刃而解