3

I have a private repository, let's say https://example.com:12345/my_package.git. I want to go get such package using HTTP.

What are the specific steps I must follow to accomplish this?

The first issue I'm facing is that I don't know where I must set the port. In the import section, it complains about invalid import path. In Gopkg.toml, it tries to go to https://example.com instead of https://example.com:12345. Just go get -d -v https://example:12345/my_package.git complains about the : char...

So, how can I do this? Using ether username/pass or token (gitlab), just not SSH.

Scott Stensland
  • 26,870
  • 12
  • 93
  • 104
  • This could help, please checkout https://stackoverflow.com/a/45936697/4944549 – vijay krishna Dec 14 '18 at 13:56
  • @vijaykrishna that's related to authentication. Authentication is not a problem because it's done by the underlying git –  Dec 14 '18 at 13:58
  • when you put your local repo on port 80 ... does it work using normal port 80 for http ? where you can leave off mention of port ... then after that is working move over to its own port but would be good to have this as a known good starting point – Scott Stensland Dec 14 '18 at 14:07
  • @ScottStensland our gitlab is only listening on 12345 –  Dec 14 '18 at 14:10
  • 1
    `go get` will only try ports 443 and 80. You'll have to setup some simple server on one of those ports that responds with the appropriate [meta tags](https://golang.org/cmd/go/#hdr-Remote_import_paths) to make `go get` work. This can also be another domain, but then your import path changes accordingly. Try `curl https://example.com:12345/some/repo?go-get=1` to see what the (presumably) correct response looks like. If that's not an option you have to clone/download the packages manually. – Peter Dec 14 '18 at 15:14
  • https != ssh, just so you know, but in the end, `go get` uses `git clone`, so adding something like `[url http://example.1234/]\ninsteadOf = https://example.com/` to your `~/.gitconfig` would work. It's more commonly used to clone over SSH instead of HTTPS, but well... your funeral I guess – Elias Van Ootegem Dec 14 '18 at 15:59

0 Answers0