go get with private gitlab repo

Issue

Despite all the attempts I can’t succeed in using “go get” to get a private repo from gitlab
I’ve tried with .netrc, gitconfig but it doesnt work.
I have a private machine with git on it, suppose it is mymachine.prv

git config --global url."git@mymachine.prv:".insteadOf "https://mymachine.prv/"

I run this command from a virtual machine with user “gp”
and it keeps asking me the password for gp@mymachine.prv

So I have generated the public key with ssh-keygen and added to gitlab account, but no luck.

Any help please?

Gianpaolo

Solution

I guess it should helps you. You miss the ssh://

Post for example how it works: https://www.scivision.dev/git-pull-https-push-ssh/

git config --global url."ssh://git@mymachine.prv/".insteadOf "https://mymachine.prv/"

Answered By – frankegoesdown

Answer Checked By – Dawn Plyler (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.