fix: normalize hostname for auth login (#6999)

Co-authored-by: Mislav Marohnić <mislav@github.com>
This commit is contained in:
Lại Tuấn Anh 2023-04-17 22:35:30 +09:00 committed by GitHub
parent dbc2f05124
commit 3d8057d856
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,6 +151,11 @@ func loginRun(opts *LoginOptions) error {
}
}
// The go-gh Config object currently does not support case-insensitive lookups for host names,
// so normalize the host name case here before performing any lookups with it or persisting it.
// https://github.com/cli/go-gh/pull/105
hostname = strings.ToLower(hostname)
if src, writeable := shared.AuthTokenWriteable(authCfg, hostname); !writeable {
fmt.Fprintf(opts.IO.ErrOut, "The value of the %s environment variable is being used for authentication.\n", src)
fmt.Fprint(opts.IO.ErrOut, "To have GitHub CLI store credentials instead, first clear the value from the environment.\n")