【分享】git clone 提示 unable to access ‘http://gitlab.xxxx/gateway.git/‘: Could not resolve host xxxx

前言:

有的时候,我们搭建gitlab之后,使用了自己的域名映射,或者我们使用的公用git地址,使用了域名做前缀,但是没有提供域名解析功能,导致执行git clone的时候,提示如下:

unable to access 'http://gitlab.xxxx/gateway.git/': Could not  resolve host xxxx

从提示上看,是无法理解这个域名。解决方案有如下两种:

1.将域名换成ip

     比如http://gitlab.xxxx 对应的ip为 172.x.x.x ,那么我们只要在git clone的时候变成ip就好。

2.添加host记录

     这里以Windows为例,如果是Mac os 或者 linux os,请自行百度即可。

     打开文件C:\Windows\System32\drivers\etc\hosts(注意这是一个只读文件,使用nodepad++使用管理员打开或者将这个文件的只读关闭)

     加入自定义域名解析:

     212.62.183.165 test.xxx.com

     212.63.183.161 oa.xxx.com

 执行1或者2之后,就可以clone项目了。

猜你喜欢

转载自blog.csdn.net/qq_26834611/article/details/114996535
今日推荐