Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save arsperger/8c5cf74418246390dc9f9792d7f0151f to your computer and use it in GitHub Desktop.
Save arsperger/8c5cf74418246390dc9f9792d7f0151f to your computer and use it in GitHub Desktop.
How to import private go module from private gitlab repo
## 1
# make git use SSH instead of HTTPS
git config --global url."git@gitlab.com:".insteadof="https://gitlab.com"
# or edit .gitconfig
[url "git@gitlab.com:"] insteadOf = https://gitlab.com
## 2
# in gitlab repo and create access tocken
## 3
# put access details to .netrc
machine gitlab.com gitlab+deploy-token-userID gitlab+deploy-token
## 4
# go to go module dir and
go build
## reference:
https://docs.gitlab.com/ee/user/project/deploy_tokens/ 41
https://docs.gitlab.com/ee/user/project/new_ci_build_permissions_model.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment