问题:
使用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 .