Skip to content

Commit ba3e1e5

Browse files
author
nate smith
committed
add subdomain wildcard helper
1 parent 0e06fde commit ba3e1e5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

internal/ghinstance/host.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,10 @@ func HostPrefix(hostname string) string {
8787
}
8888
return fmt.Sprintf("https://%s/", hostname)
8989
}
90+
91+
func HostSubdomainWildcard(hostname string) string {
92+
if strings.EqualFold(hostname, localhost) {
93+
return hostname
94+
}
95+
return fmt.Sprintf("*.%s", hostname)
96+
}

pkg/cmd/auth/shared/git_credential.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ func (flow *GitCredentialFlow) gitCredentialSetup(hostname, username, password s
121121
}
122122

123123
func gitCredentialHelperKey(hostname string) string {
124-
return fmt.Sprintf("credential.%s.helper", strings.TrimSuffix(ghinstance.HostPrefix(hostname), "/"))
124+
host := strings.TrimSuffix(
125+
ghinstance.HostPrefix(
126+
ghinstance.HostSubdomainWildcard(hostname)), "/")
127+
return fmt.Sprintf("credential.%s.helper", host)
125128
}
126129

127130
func gitCredentialHelper(hostname string) (helper string, err error) {

0 commit comments

Comments
 (0)