問題:
使用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 .