go-import meta tag with github enterprise

3,171 views
Skip to first unread message

jl...@riotgames.com

unread,
Jul 22, 2014, 6:41:06 PM7/22/14
to golan...@googlegroups.com
hi,

i'm trying to get the go-import meta tag to work our own github enterprise installation. it's running as gh.mydomain.com, so one of the project i need to go get is gh.mydomain.com/org/myapp. i've updated to github enterprise 11.10.342, which has the go-import meta tag support. however, since authentication is enabled, when i do a go get, it redirects me to the login url, and the go-import meta tag is only available while i'm logged in. therefore running go get from the command prompt failed to import the project.

i've tried google around solutions for this and has not found anything obvious. i've tried to generate a token and use a .netrc file, but couldn't figure out how to make go get to use that. 

does anyone solve a similar problem? thanks.

David Symonds

unread,
Jul 23, 2014, 2:06:52 AM7/23/14
to jl...@riotgames.com, golang-nuts
`go get` will run a command like
git clone <repo> <dest>

If you run that manually (replacing <repo> with the final Git URL,
*not* gh.mydomain.com/org/myapp), does it work?

Andrew Gerrand

unread,
Jul 23, 2014, 2:53:30 AM7/23/14
to jl...@riotgames.com, golang-nuts

On 23 July 2014 08:41, <jl...@riotgames.com> wrote:
it redirects me to the login url, and the go-import meta tag is only available while i'm logged in. therefore running go get from the command prompt failed to import the project.

Hm, this might be problematic. Is it possible to disable authentication for requests with the "go-get=1" query string? It surprises me that GitHub enterprise has "go-import meta tag support" but that it doesn't work with authentication enabled.

(David Symonds may be heading down the wrong trail; the "go get" command does an HTTPS/HTTP request to the vanity domain before invoking git.)

What does "go get -v gh.mydomain.com/org/myapp" print?

Andrew

jl...@riotgames.com

unread,
Jul 23, 2014, 3:15:54 AM7/23/14
to golan...@googlegroups.com, jl...@riotgames.com
@David: i tried to git clone with the git url, and it didn't work. and i tried to git clone with the https url, it does work  (with the .netrc file):

~$ git clone g...@gh.mydomain.com:org/myapp.git
Cloning into 'myapp'...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Cloning into 'myapp'...
remote: Counting objects: 20, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 20 (delta 0), reused 17 (delta 0)
Unpacking objects: 100% (20/20), done.

i basically follow this http://blogdown.io/c4d42f87-80dd-45d5-8927-4299cbdf261c/posts/574baa68-f663-4dcf-88b9-9d41310baf2f to set up my .netrc file. my suspect is this works for private repo on github.com, but not repo in a github enterprise, but i haven't verified that myself.

@Andrew: i'll check with our github admin to see if we can set up the redirect, but that solution seems a bit hacky for such a common use case for github enterprise. also below is the output from running go get -v:

ignoring https fetch with status code 404
Parsing meta tags from http://gh.mydomain.com/org/myapp?go-get=1 (status code 404)
package gh.mydomain.com/org/myapp: unrecognized import path "gh.mydomain.com/org/myapp"

also, i want to point out our github enterprise disabled http and only allow https/ssh, not sure does that matter though.

Josiah Kiehl

unread,
Jul 23, 2014, 8:40:15 PM7/23/14
to golan...@googlegroups.com, jl...@riotgames.com
One solution is to edit your git config as such:


If you are on the latest GH:E, you should be able to use `go get` without issue. If not, you'll still need to postfix '.git' to the import.

Josiah
Reply all
Reply to author
Forward
0 new messages