Preliminary support for GitHub Enterprise - #823
Conversation
How to test:
- backup your old config: `cp ~/.config/gh/config.yml{,.bak}`
- clear the config `rm ~/.config/gh/config.yml`
- set `export GITHUB_HOST=ghe.example.com` to your GHE hostname
- run a `gh` command
- clear the config again when done testing `rm ~/.config/gh/config.yml`
tierninho
left a comment
There was a problem hiding this comment.
Thanks for the setup instructions! I ran through the following commands and set the host to our internal GHE host and was authenticated properly ✅. The host is also present in the config file. ✅
run a gh command
I did place bin/ in front of each command and was able to access the repo on the GHE host ✅ and executive a few gh commands successfully.
Note, I was blocked on a few commands like this, which I believe is expected given the infancy of the things. Let me know if otherwise, or if I missed anything.
➜ cli git:(ghe-prototype) bin/gh pr list -R tierninho/Blah
graphql error: 'Field 'isDraft' doesn't exist on type 'PullRequest''
|
@mislav I cherry picked this onto The following patch fixes this for me: diff --git i/internal/ghrepo/repo.go w/internal/ghrepo/repo.go
index dc3115b..f7e745c 100644
--- i/internal/ghrepo/repo.go
+++ w/internal/ghrepo/repo.go
@@ -3,11 +3,18 @@ package ghrepo
import (
"fmt"
"net/url"
+ "os"
"strings"
)
// TODO these are sprinkled across command, context, config, and ghrepo
-const defaultHostname = "github.com"
+var defaultHostname = "github.com"
+
+func init() {
+ if gheHostname := os.Getenv("GITHUB_HOST"); gheHostname != "" {
+ defaultHostname = gheHostname
+ }
+}
// Interface describes an object that represents a GitHub repository
type Interface interface {
|
|
Tested on GitHub Enterprise Server 2.20.6. OSX. A first sweep of testing the What was tested: PASS
FAIL
What I couldn’t test for the time being
-- 2.19 tests in progress... |
|
and here are the results on: GHE Version 2.19.12 a099171, OSX. More tests passed only because I had access to the login credentials after using What was tested: PASS
FAIL
|
If you use
I think is something we could fix easily, perhaps by applying @jgilchrist's patch above. |
Got it working ⚡ after resolving a password issue. |
This is a rough code spike to explore GitHub Enterprise compatibility. The experience in this branch isn't very user-friendly yet: you have to manually juggle your config files and you have to set the GITHUB_HOST environment variable to your GHE hostname while testing (i.e. the Enterprise hostname will not get automatically picked up from your existing git remotes). But, it works!
How to test:
cp ~/.config/gh/config.yml{,.bak}rm ~/.config/gh/config.ymlexport GITHUB_HOST=ghe.example.comto your GHE hostnamemakebin/ghcommandmv ~/.config/gh/config.yml{.bak,}Ref. #273