Support GitHub Enterprise (formerly FI) #98

Closed
kergoth opened this Issue Oct 28, 2011 · 17 comments

Comments

Projects
None yet
5 participants

kergoth commented Oct 28, 2011

It would be handy if hub had the ability to support github FI installations (see http://fi.github.com/). Currently I just branched off of 1.6 and replaced the github.com references, but it would be nice if it supported it in a more convenient way. git-pulls supports it via a git config option (e.g. git config --global github.host github.mycompany.com).

Member

mislav commented Oct 28, 2011

I'm interested in supporting this as long as it still enables you to handle open source repos from main GitHub. I don't want to force people to choose between their work repos and OSS but can't have both.

kergoth commented Oct 28, 2011

Agreed, I do development for both. Absolutely critical. It's not a high priority thing, I don't mind maintaining a branch for my FI instance. There aren't that many places in the code to replace it, but I could see others wanting that sort of functionality in the future.

Currently I have multiple standalone hubs, one patched to point at the work host, one pointing at upstream. If we used the git config method, you'd have to use a separate VM/chroot/machine for one vs the other, assuming you need commands like clone to behave. If you only used fork, etc, you could set the git config option in the repo instead of the host. Of course, it could also obey an env var -- GITHUB_HOST or similar.

Alternatively, if you wanted to support it via separate standalone binaries, could always template it in the sources and generate the output for one host or another at build time, rather than determining it at run time. shrug

Member

defunkt commented Oct 31, 2011

It would be cool if you could add host aliases, ala fi, then specify them when cloning.

$ git clone -a fi user/repo

Would use the host alias fi, which might expand to github.mycompany.com based on what you've set in your gitconfig.

Member

mislav commented Nov 23, 2011

How about using git core features for this?

$ git config --global url."git@github.com:".insteadOf gh:
$ git clone gh:mislav/hub.git

Of course, instead of github.com there would be the name of your server.

I just don't think it's worth implementing this in hub.

kergoth commented Dec 17, 2011

Note: hub am fails with FI/Enterprise today, presumably because it's using curl to fetch rather than leveraging the github api token -- curl gets redirected to the login page :)

Member

mislav commented Dec 17, 2011

@kergoth this is probably fixed in master (5b7bc77), try to install edge version with brew upgrade hub --HEAD on OS X

kergoth commented Dec 17, 2011

Ah, thanks, will do :)

Member

mislav commented Dec 17, 2011

Does Enterprise allow tokens at all? The one stored in git config github.token is for main GitHub.com, not Enterprise…

kergoth commented Dec 17, 2011

I'm testing against FI right now -- haven't upgraded to Enterprise. FI at least will obey the info in the gitconfig. I patch hub to point all the urls at our instance, and modify the .gitconfig on that particular machine to the info from the FI instance. Not ideal, but gets the job done.

damianb commented Dec 17, 2011

perhaps a central variable should be used in hub for the "github" url?

Member

mislav commented Dec 17, 2011

It just occurred to me that there's no way hub can work with Enterprise since all API calls and other URLs are hardcoded to "github.com". I can work on a patch, but I need to know the following:

  1. does it have the same API as github.com
  2. does it support token auth

kergoth commented Dec 17, 2011

As I said a couple comments ago, I had to patch the urls in hub :) It does seem to use the same API, and it does seem to support the token auth -- at least, hub does work with our FI instance. I'm able to fork, etc, which afaik wouldn't work without it.

@mislav mislav closed this in 06c18ff Dec 21, 2011

Member

mislav commented Dec 21, 2011

OK, Enterprise folks. I've pushed something big. brew upgrade hub --HEAD

You have to first tell hub that your Enterprise hosts exists, then configure a separate user/token for it. (This way your existing github.com config stays untouched.)

$ git config --global --add hub.host my.git.org
$ git config --global github."my.git.org".user mislav
$ git config --global github."my.git.org".token 1234abcd

Now a lot of hub operations will work on repos that were cloned from your Enterprise host. But git clone, for instance, would still clone from default github.com host. To affect this, there is an environment variable for now:

GITHUB_HOST=my.git.org git clone myproject

@mislav I've ran the update and set the configs for github and our enterprise github as you specified, however I'm getting "fatal: Not a git repository" whenever I attempt to run a git clone. (This includes anything in our github.enterprise.com or on github.com).

mislav added a commit that referenced this issue Dec 21, 2011

Member

mislav commented Dec 21, 2011

@HighwayofLife: thanks for reporting it. It was just the clone command that was broken. I've pushed a fix

@mislav Awesome, it seems to be working now. Thank you! If I find any additional issues while running hub with Enterprise, should I report them to this ticket or to a new ticket?

Member

mislav commented Dec 21, 2011

new ticket so we avoid spamming people subscribed to this thread

jasonnoble added a commit to jasonnoble/hub that referenced this issue Dec 11, 2012

Add Github Enterprise configuration steps
From #98, it appears that Github Enterprise support
was added a year ago, however the documentation did not
explain how to get it setup.

Added a Github Enterprise section to the Configuration 
section of the README.md.

#98 also had `git config --global github."my.git.org".token 1234abcd`,
but I found I didn't need that line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment