I’m keeping my projects privately on gitlab.com and want to use for some of my golang packages standard “go get” command instead of using git clone/pull. When I’m trying to use standard commands I’m getting the error
go get gitlab.com/bykovme/my_package_here # cd .; git clone https://gitlab.com/bykovme/my_package_here.git /home/bykov/gopath/src/gitlab.com/bykovme/my_package_here Cloning into '/home/bykov/gopath/src/gitlab.com/bykovme/my_package_here'... fatal: could not read Username for 'https://gitlab.com': terminal prompts disabled
As I’m using SSH keys to access the git repository, the following command solves the issue giving possibility to use standard go packages commands
git config --global url."email@example.com:".insteadOf "https://gitlab.com/"
You can check if it was applied using the following command
The output of the command above should be like the text below
[url "firstname.lastname@example.org:"] insteadOf = https://gitlab.com/
go get gitlab.com/bykovme/my_package_here
is working now.
PS. The same solution is working for github.com