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

can't get ghub to work with GHE #53

Closed
donahchoo opened this issue Apr 1, 2018 · 13 comments
Closed

can't get ghub to work with GHE #53

donahchoo opened this issue Apr 1, 2018 · 13 comments

Comments

@donahchoo
Copy link

donahchoo commented Apr 1, 2018

Hi, I'm using a GHE well trying. I'm not an emacs expert so it is probably just me not understanding how to setup the config and then test. Perhaps @diasjorge and @whirm can share their config and testing instructions?

I've tired manually created my .authinfo but I'm still prompted for the wizard and the wizard wants to use api.github.com instead of my GHE instance... Help?

.gitconfig:

[github "foo.bar.com/api/v3"]
        user = donahchoo

.authinfo:

machine foo.bar.com/api/v3 login donahchoo^ghub password TOKEN

try a get:

(ghub-get "/users/donahchoo/repos")

Result:

Such a Github API token is not available:                                                                
                                                                                                         
  Host:    api.github.com                                                                                
  User:    donahchoo                                                                                       
  Package: ghub                                                                                          
@diasjorge
Copy link

I wrote an explanation in my blog how to do it: https://mrdias.com/2018/04/01/using-magit-with-github-enterprise.html

Anyway I think if you're getting prompted for a token it might be you haven't configured the ghub.host for the repo you're visiting. https://magit.vc/manual/ghub/Setting-the-Username.html#Setting-the-Username

@donahchoo
Copy link
Author

donahchoo commented Apr 2, 2018

Thanks @diasjorge! Much closer now... I'm not sure where the problem was. However, when I try to list the issues I'm prompted for my username and password. Then I get this:

HTTP Error: 400, "Bad Request", "and Github didn't return JSON"

All the URLs look correct, but I don't understand why I'm getting prompted for my username and password if I have the ~/.authinfo setup...

machine github.foo.bar.com/api/v3 login donahchoo^ghub password TOKEN
machine github.foo.bar.com/api/v3 login donahchoo\^magithub password TOKEN

Also, I have my username set:

[github "github.foo.bar.com/api/v3"]
        user = donahchoo
[github]
        user = donahchoo

Thoughts?

@vermiculus
Copy link
Contributor

If you're getting HTTP 400, I'd be curious to see the full request. Not sure how to go about that with url though.

@vermiculus
Copy link
Contributor

Not without debugging ghub.

@donahchoo
Copy link
Author

@vermiculus I can try to debug ghub. Just need to know how.

I'm also pretty sure this is SSO related which is why I opened the other issue...

@vermiculus
Copy link
Contributor

Instrument ghub-request and just step through. Elisp has a decent debugger.

@diasjorge
Copy link

diasjorge commented Apr 2, 2018 via email

@donahchoo
Copy link
Author

donahchoo commented Apr 2, 2018 via email

@diasjorge
Copy link

You could use M-x eval-expression and execute the following expression on the magit-status buffer. (ghub--host) and see if it's making the request to the right host.

@donahchoo
Copy link
Author

going to close this! I think @diasjorge blog did the trick!

@tarsius
Copy link
Member

tarsius commented Apr 14, 2018

Ah! The things blog posts can do that the official manual can not... (The tip about includeIf is very useful, but everything else is covered by the manual.)

You are not saying what eventually fixed the problem, but for future reference, I think it is that you did eventually set ghub.host. Without that ghub tries to access api.github.com.

@donahchoo
Copy link
Author

@tarsius the manual is a great reference and it awesome you have documentation. However it is not substitute for a step by step guide for how to do things. I read the manual several times and couldn't get things to work. The blog post also talks about having an entry for github.com and your GHE instance. I think that made the difference. I'm not finding that I set ghub.host, unless that comes from .authinfo.

@tarsius
Copy link
Member

tarsius commented Apr 17, 2018

I have improved the manual, the "Getting Started" node and the first two points in "Interactively...". Please have another look - does that address the things that previously were unclear?

7f23879

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants