gitlab go mod 引用私有仓库(上)

1.获取gitlab的access token
打开所需要Token的项目
然后Setting --> CI/CD --> Genneral pioelines settings --> Expand --> Runner token


gitlab go mod 引用私有仓库(上)_第1张图片
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中


gitlab go mod 引用私有仓库(上)_第2张图片
image.png
gitlab go mod 引用私有仓库(上)_第3张图片
image.png

gitlab go mod 引用私有仓库(上)_第4张图片
image.png

3.配置git将请求从ssh转换为http

git config --global url."[email protected]:groupName/projectName.git".insteadOf "https://gitlab.com/groupName/projectName.git"`

4.拉取

go get -u -v gitlab.com/groupName/projectName

你可能感兴趣的:(gitlab go mod 引用私有仓库(上))