1.获取gitlab的access token
打开所需要Token的项目
然后Setting --> CI/CD --> Genneral pioelines settings --> Expand --> Runner token
image.png
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中
image.png image.png
image.png
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
网友评论