From 3d8057d856b074609350f62967854a3dfb322b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=E1=BA=A1i=20Tu=E1=BA=A5n=20Anh?= <42168740+tuananhlai@users.noreply.github.com> Date: Mon, 17 Apr 2023 22:35:30 +0900 Subject: [PATCH] fix: normalize hostname for auth login (#6999) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mislav Marohnić --- pkg/cmd/auth/login/login.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/cmd/auth/login/login.go b/pkg/cmd/auth/login/login.go index 699cdcf77..84894bf10 100644 --- a/pkg/cmd/auth/login/login.go +++ b/pkg/cmd/auth/login/login.go @@ -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")