3

We use github enterprise server over a VPN.

If I type:

go get privateserver.com/path/to/myproject.git

I get this result:

package privateserver.com/path/to/myproject.git: cannot download, privateserver.com/path/to/myproject uses insecure protocol

Or removing the .git suffix I get:

package privateserver.com/path/to/myproject: unrecognized import path "privateserver.com/path/to/myproject" (parse https://privateserver.com/path/to/myproject?go-get=1: no go-import meta tags ())

It seems there are many similar questions on google searches but have found no answers that actually work.

What I really want to end up with is automation of docker builds. Inside my docker file I require a go get. But I can't store the credentials inside the docker file.

Note: --insecure doesn't work. See bottom of question.


Just tried go get with -insecure -v options. I get the following output:

matthewh@xen:~/go/src/$ go get -insecure -v privateserver.com/path/to/myproject.git
# cd .; git ls-remote git://privateserver.com/path/to/myproject
fatal: remote error: 
  GitHub private mode is enabled. Git protocol is disabled. Use authenticated http or ssh access instead.
# cd .; git ls-remote https://privateserver.com/path/to/myproject
fatal: could not read Username for 'https://privateserver.com': terminal prompts disabled
# cd .; git ls-remote http://privateserver.com/path/to/myproject
fatal: could not read Username for 'https://privateserver.com': terminal prompts disabled
# cd .; git ls-remote git+ssh://privateserver.com/path/to/myproject
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
# cd .; git ls-remote ssh://privateserver.com/path/to/myproject
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
privateserver.com/path/to/myproject.git (download)
# cd .; git clone privateserver.com/path/to/myproject /home/matthewh/go/src/privateserver.com/path/to/myproject.git
fatal: repository 'privateserver.com/path/to/myproject' does not exist
package privateserver.com/path/to/myproject.git: exit status 128
hookenz
  • 36,432
  • 45
  • 177
  • 286

1 Answers1

1

The get command supports using http by using the -insecure flag as shown below:

go get -insecure privateserver.com/path/to/myproject.git

The default is secure HTTPS in order to prevent man in the middle attacks as described in Git Issue.

miltonb
  • 6,905
  • 8
  • 45
  • 55
  • If I do that, I get a "repository does not exist error. – hookenz Jan 24 '18 at 03:29
  • Just looked at your profile. Are you Milton Baxter? – hookenz Jan 24 '18 at 03:29
  • Indeed I am. Are you @Matt somebody?. Have you tried without the .git suffix. I tried a little test run here with just `/myproject` – miltonb Jan 24 '18 at 03:39
  • 2
    haha. Milton, here's a hint. Peter is not my dad and Malaysia was fun. Must catch up some time. The git suffix seems to be required on private github servers. – hookenz Jan 24 '18 at 03:43