Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aloha1003/83ea20ce62d48f4f74d3124edd9d016d to your computer and use it in GitHub Desktop.
Save aloha1003/83ea20ce62d48f4f74d3124edd9d016d to your computer and use it in GitHub Desktop.
Go Get from private repository

I had a problem with go get using private repository on gitlab from our company. I lost a few minutes trying to find a solution.... and I did find one:

  1. You need to get a private token at:

    https://gitlab.mycompany.com/profile/account

  2. Configure you git to add extra header with your private token:

    $ git config --global http.extraheader "PRIVATE-TOKEN: YOUR_PRIVATE_TOKEN"

  3. Configure your git to convert requests from ssh to http:

    $ git config --global url."git@gitlab.mycompany.com:".insteadOf "https://gitlab.mycompany.com/"

  4. Finally you can use your go get normally

    $ go get gitlab.com/company/private_repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment