Skip to content

Instantly share code, notes, and snippets.

@kagemusha
Created June 13, 2018 16:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kagemusha/de730794fe1abde2bd9b49f35fdf3a59 to your computer and use it in GitHub Desktop.
Save kagemusha/de730794fe1abde2bd9b49f35fdf3a59 to your computer and use it in GitHub Desktop.
go get with private github repo
1. If you are trying to `go get` a private repo, you need to be able to enter your `username` and `password` from the prompt.
To get the prompt you need to enable the git terminal prompt.
env GIT_TERMINAL_PROMPT=1 go get 'github.com/the-user/the-repo'
2. Because of 2FA you cannot use your password. You need to generate an access token and enter that in the password field
instead (you will want to copy at the clipboard on the token generation page, b/c it will be long). To generate the token, go
to [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new). Or from the Github UI,
` Setting - Developer Settings - Personal access tokens`
If you use your password instead of an access token, you will get
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/the-user/the-repo'
package github.com/movableink/go-go-common-go: exit status 128
3. If you want to update package, add -u option
env GIT_TERMINAL_PROMPT=1 go get -u 'github.com/the-user/the-repo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment