go get with git repository with http

Phanix
·
·
IPFS
·

When the go tools of go lang do go get, the default is to use https to access the git repository, but when https cannot be used and can only run http, some changes must be made.

In fact, the go get command is also executed through the git command, but it will be accessed by adding https:// in front of the git repository. E.g:

 $ go get GIT.URL/NAMESPACE/Repository.git

In fact, it will add https:// to GIT.URL/NAMESPACE/Repository.git for git to process, so it becomes something like

 $ git clone https://GIT.URL/NAMESPACE/Repository.git

So if https can't be used, it can only go to http. At this time, I have to start with git config and change to ssh

 git config --global url."git@GIT.URL:".insteadOf "https://GIT.URL/"

or go http

 git config --global url."http://GIT.URL/".insteadOf "https://GIT.URL/"

Original link: Phanix's Blog

CC BY-NC-ND 2.0

Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!