Git push出现Could not resolve host问题解决

Could not resolve host:xxx 问题


当我们在使用git进行推送的时候有时会遇到Could not resolve host的问题,一般我们都会尝试重启网络再尝试push,这样无法从根本解决问题。目前还有一种更为有效的方式:通过改host配置文件来完成。

具体错误如下

git push origin channels/xxxx
fatal: unable to access 'https://git.dev.tencent.com/xxxx/xxxx.git/': Could not resolve host: git.dev.tencent.com

首先我们ping无法resolv的host

ping git.dev.tencent.com
PING git.tencentcloud.coding.net (118.25.166.124): 56 data bytes
64 bytes from 118.25.166.124: icmp_seq=0 ttl=51 time=34.578 ms
64 bytes from 118.25.166.124: icmp_seq=1 ttl=51 time=36.573 ms

然后修改host文件即可

sudo vi /etc/hosts
# 文件增加一行 118.25.166.124 git.tencentcloud.coding.net #git.tencentcloud.coding.net

如果还不可以需要执行如下命令

git config --global --unset http.proxy
git config --global --unset https.proxy 

搞定

补充
有朋友留言如下:
感觉是coding被收购后内部在维护,

git.coding.net和git.dev.tencent.com原来是指向相同的服务器,

试了下面这样,发现也可以

git remote add coding https://git.coding.net/xxxx/xxxx.git/
git push coding master

3
欢迎留言

avatar
2 Comment threads
1 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
3 Comment authors
yuanboMiaomiaoChichi Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Chichi
Guest
Chichi

👍

解决了我的问题

Miaomiao
Guest
Miaomiao

感觉是coding被收购后内部在维护,

git.coding.net和git.dev.tencent.com原来是指向相同的服务器,

试了下面这样,发现也可以
> git remote add coding https://git.coding.net/xxxx/xxxx.git/
> git push coding master