gitlab go mod 引用私有仓库(上)
2019-03-27 本文已影响0人
不要重不要重
1.获取gitlab的access token
打开所需要Token的项目
然后Setting --> CI/CD --> Genneral pioelines settings --> Expand --> Runner token

git config --global http.extraheader "PRIVATE-TOKEN: YOUR_PRIVATE_TOKEN"
把Runner token文本框中的内容替换上面的YOUR_PRIVATE_TOKEN
2.为GitLab帐号添加SSH keys
cat ~/.ssh/id_rsa.pub
把上述内容添加到gitlab中



3.配置git将请求从ssh转换为http
git config --global url."git@gitlab.com:groupName/projectName.git".insteadOf "https://gitlab.com/groupName/projectName.git"`
4.拉取
go get -u -v gitlab.com/groupName/projectName