Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a uri_scheme option #247

Closed
wants to merge 3 commits into from
Closed

Conversation

mmrobins
Copy link

This allows github enterprise installations that don't use https to use the
hub gem.

I think all installations should use https, but I don't control my company's
install, and their argument for not using https is that the install is only
available over VPN, so traffic is already encrypted, and using https means
they'd need to buy another https cert.

So until I can convince them otherwise, I'd still like to be able to make
pull-requests from the command line.

The cucumber tests don't run for me

undefined method `posix_spawn=' for ChildProcess:Module (NoMethodError)

so I haven't updated them. If I comment out that line in
features/support/env.rb there's already failures in the master branch, so it's
hard to tell if my changes could have broken anything.

@mmrobins mmrobins mentioned this pull request Oct 13, 2012
mislav added a commit that referenced this pull request Nov 6, 2012
@gvaughn
Copy link

gvaughn commented Nov 11, 2012

I'm in the same boat: http only for our GH:Ent install. However, there seems to be a chicken and egg problem here. I can't get hub to generate the ~/.config/hub file containing an auth token in the first place. But I need that file to tell hub I want to use http instead of https. Is there a workaround?

@mmrobins
Copy link
Author

@gvaughn When I run something like hub fork for a project on github enterpirse and don't have a ~/.config/hub, it generates a ~/.config/hub entry for my github enterprise with uri_scheme set to https as soon as I enter my username. Then when I enter my password, it fails with "Errno::ECONNREFUSED" because of the uri_scheme issue. Then I just change the uri_scheme in the ~/.config/hub, and rerun hub fork, and this time when I enter my password it works and puts the oauth_token in.

Does it not generate the ~/.config/hub with an entry for your github enterprise url when you enter your username at the prompt? If so, maybe you didn't follow the instructions to whitelist your github enterprise?

git config --global --add hub.host my.example.org

This allows github enterprise installations that don't use https to use
the hub gem.

I think all installations should use https, but I don't control my
company's install, and their argument for not using https is that the
install is only available over VPN, so traffic is already encrypted, and
using https means they'd need to buy another https cert.

So until I can convince them otherwise, I'd still like to be able to
make pull-requests from the command line.
@mislav
Copy link
Owner

mislav commented Nov 11, 2012

Hey guys. The current process for adding an enterprise host is convoluted and too manual, even more so if I merge this pull request. This is evident by your current problems. I need to improve this.

The code in this pull request is solid and I will work with that. However you don't need to contribute to this pull request further. I'm in the process of restructuring things a little, and will report back when done.

@mmrobins
Copy link
Author

@mislav I just noticed that the cucumbers were passing in master, so I was working a bit on fixing those with my PR.

I realized that with my "fix" to hub browse I made it so it didn't work without there being a ~/.config/hub entry, which shouldn't be necessary and caused lots of cuc failures, so I fixed that and force pushed to get it based off master with the new code. It's still a little awkward to need to load the ~/.config/hub in lib/hub/context.rb, but I think a little better.

I also noticed that one of the remaining cucumber failures says that the ~/.config/hub shouldn't be present if the authentication step fails, and that's no longer the case. I was going to work on fixing that, but I'll hold off if you're restructuring.

Let me know if I can help with the restructuring or any further improvements to this branch and thanks again.

@gvaughn
Copy link

gvaughn commented Nov 12, 2012

Just got back to this. Thanks for the replies. I hadn't pulled down this PR yet and figured out how to override my brew-installed hub. It is the 1.10.12 code that won't create the ~/.config/hub if there's an auth error. So I'm not really reporting anything knew.

@mislav will you follow up here with your progress or is there somewhere else I should sign up to stay in the loop?

@mmrobins
Copy link
Author

@gvaughn, I'm a little confused how you expect to be able to change the scheme to http from https if you haven't pulled down this PR yet. The currently released code for hub won't let you do that, but if you're running the code in this PR, then the steps I describe above should work for you until @mislav finishes restructuring, merging and releasing some form of this PR.

@gvaughn
Copy link

gvaughn commented Nov 12, 2012

@mmrobins Sorry for the confusion. I didn't have a lot of time to devote to this. I was going to quickly set up my config file, then figure out how to get your branch to mask the brew'd hub (and be easy to undo) as a second step. I now understand that ordering doesn't work. I'll try to find time to do it right this evening.

@gvaughn
Copy link

gvaughn commented Nov 13, 2012

@mmrobins I got it working. I just had to read the docs. I moved my old hub script and then ran "rake install prefix=/usr/local" from a clone of your branch. I got ~/.config/hub setup with 'http' and my initial experiments with 'hub browse' is working great. Thanks.

I'll still keep an eye on @mislav 's long term solution, but this is a great step forward for the time being.

@mmrobins
Copy link
Author

mmrobins commented Mar 1, 2013

@mislav just remembered this PR since I had a coworker ask about using hub. Any word on the restructuring of enterprise auth? I'll haven't checked the code in master in a while, but I can try to rebase or something if it would help get this in.

@mislav
Copy link
Owner

mislav commented Mar 2, 2013

I didn't yet get around to improving that. I definitely want to have an enterprise command that configures your enterprise host (optionally with plain http) and saves everything to ~/.config/hub instead of hub.host in your gitconfig. However, the new solution would have to be backwards compatible with people who are currently using Enterprise.

It's a tricky problem. You're welcome to take a stab.

@Yeraze
Copy link

Yeraze commented Feb 3, 2014

So it's been almost a year.. Any progress on this?

@mmrobins
Copy link
Author

mmrobins commented Feb 3, 2014

I've just been using my branch to run hub commands, feel free to use it as well. I haven't tried to merge any of master back in or anything, but may try. I didn't really want to take a stab at and enterprise command either.

@gvaughn
Copy link

gvaughn commented Feb 3, 2014

I can confirm that. I've been running @mmrobins branch this entire time. No complaints. However, I did have a co-worker ask me the other day how 'git browse' was working for me. When I pointed them to this thread, they declined spending the time to set it up and be off mainline hub.

@mislav
Copy link
Owner

mislav commented Feb 3, 2014

No progress. I'm sorry. I wanted to cover this while making a specialized hub subcommand that handles authentication and Enterprise configuration, but I never got around to actually writing it.

I'll think about merging parts of this PR and have people edit their hub config file manually if they really want this. The PR is good stuff; I just want the diff to be smaller and I have an idea how to achieve that.

@Yeraze
Copy link

Yeraze commented Feb 4, 2014

So, I loaded up the @mmrobins fork and that gets me the basics.. But browse, compare, etc (the various webpage loading functions) still try to load an https url (and fail). How do I override that?

@msabramo
Copy link
Contributor

@Yeraze: Did you set:

uri_scheme: http

in ~/.config/hub? That's what made browse work for me.

@msabramo
Copy link
Contributor

#485 is #247 (this PR) but updated for the latest code on master.

@msabramo
Copy link
Contributor

or for a smaller change that only makes browse work, see #484 ("Allow browse to work with Enterprise server with only HTTP"), but it probably makes more sense to look at #485, since that is more comprehensive and is derived from this PR, which has been tested for a while by @mmrobins and @gvaughn.

@Yeraze
Copy link

Yeraze commented Feb 12, 2014

Ah.. got it figured out, thanks :)

@msabramo
Copy link
Contributor

@Yeraze: Cool! You might want to try #484 #485, as this has the changes here and the latest stuff on master. If it works, you could give it a thumbs up (:+1:), which would maybe help with getting it merged.

@Yeraze
Copy link

Yeraze commented Feb 12, 2014

I went straight for #485 actually, but I'll do that :)

@msabramo
Copy link
Contributor

Oops, I meant #485 actually 😄 Sorry. Mixing up PRs.

@mislav
Copy link
Owner

mislav commented Feb 24, 2014

Thanks for the feature idea. This is now possible in master via the protocol option (instead of uri_scheme)

@mislav mislav closed this Feb 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants