jenkins从gitlab拉取go项目且项目中引入私有仓库,go get报错connect: connection refused

问题:

使用jenkins从gitlab拉取go项目在编译时还需要下载import的私有库,报connect: connection refused

 

原因:

因gitlab没有开启https导致连接443端口失败

 

解决方法:

1. 在gitlab添加jenkins服务器的ssh公钥.

2.将http请求转换为ssh请求

git config --global url."git@gitlab.mycompany.com".insteadOf "https://gitlab.mycompany.com/"

3. 拉取代码

GOPROXY="" go get -insecure .

 

posted @ 2022-03-14 18:07  默读自我  阅读(966)  评论(0)    收藏  举报