You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We face issues within a corporate network when trying to use gh cli with two GitHub instances - one hosted in Cloud, one hosted on-premises.
The problem occurs, when setting the HTTP_PROXY / HTTPS_PROXY / NO_PROXY environment variable to point to the corporate internet proxy.
gh cli is considering the proxy setting when connecting to the Cloud hosted GHES, but not considering the NO_PROXY when connecting to the on-premises one.
$ gh --version
gh version 2.5.1 (2022-02-15)
Steps to reproduce the behavior
Type this '...'
export HTTP_PROXY=proxy.corp.internal:81
export NO_PROXY=.internal
gh auth login --hostname github.corporate.com # this works fine
gh auth login --hostname github.corp.internal # this fails due to attempt to connect through the proxy
View the output '....'
## see above
See error
gh auth login --hostname github.corp.internal
failed to authenticate via web browser: Post "https://github.corp.internal/login/device/cde": authenticationrequired
Expected vs actual behavior
gh cli should consider the NO_PROXY / no_proxy environment variable and skip the internet proxy when connecting to local GHES endpoints.
gh doesn't natively handle any of these environment variables -- they are consumed by Go's http connection code. We can at least document these variables in our manual, but we prefer to defer to Go's networking code here and do not intend to add our own proxy handling code to gh.
Going to close this for now, but feel free to use this issue for documenting further workarounds.
ok, found my problem... my bad.
there are multiple internal domains in the corporate network and for other tools it was fine to give it space separated as:
Activity
samcoe commentedon Feb 24, 2022
Ref. #2037
sergeiwaigant commentedon Feb 24, 2022
There is a "workaround" by just giving
HTTP_PROXY=""in front of theghexecution when connecting to the github.corp.internal, just like...vilmibm commentedon Mar 2, 2022
Hi,
ghdoesn't natively handle any of these environment variables -- they are consumed by Go's http connection code. We can at least document these variables in our manual, but we prefer to defer to Go's networking code here and do not intend to add our own proxy handling code togh.Going to close this for now, but feel free to use this issue for documenting further workarounds.
sergeiwaigant commentedon Mar 3, 2022
ok, found my problem... my bad.
there are multiple internal domains in the corporate network and for other tools it was fine to give it space separated as:
NO_PROXY=".dev.corp .preprod.corp .prod.corp"For gh I had to add just a comma in between as:
NO_PROXY=".dev.corp, .preprod.corp, .prod.corp"The reference to Go's http connection code helped a lot - thank you!
https://pkg.go.dev/golang.org/x/net/http/httpproxy