There are two options to clone a git repository from github: git over ssh or https.

Cloning via https requires either your github login credentials or a github access token in $HOME/.gitconfig. When using git over ssh you authenticate with your ssh key.

By default, go uses https to clone repositories from github when you run e.g. go get So for cloning private repositories that means I somehow had to authenticate with github in a way I described above. The same was necessary to push into any repository (public or private).

What I ended up most of the time was either cloning my private repositories manually (via git over ssh) or manually changing the remote locations of repositories I downloaded via go get to use git over ssh. I was not satisfied with either options so I was extra happy when I was told about this little bit you can put in $HOME/.gitconfig:

[url ""]
insteadOf =

With this configuration, every time you clone something from a repository starting with git automatically uses instead.