MCPcopy
hub / github.com/cli/cli / CredentialPatternFromGitURL

Function CredentialPatternFromGitURL

git/client.go:123–129  ·  view source on GitHub ↗

CredentialPatternFromGitURL takes a git remote URL e.g. "https://github.com/cli/cli.git" or "git@github.com:cli/cli.git" and returns the credential pattern that should be used for it.

(gitURL string)

Source from the content-addressed store, hash-verified

121// CredentialPatternFromGitURL takes a git remote URL e.g. "https://github.com/cli/cli.git" or
122// "git@github.com:cli/cli.git" and returns the credential pattern that should be used for it.
123func CredentialPatternFromGitURL(gitURL string) (CredentialPattern, error) {
124 normalizedURL, err := ParseURL(gitURL)
125 if err != nil {
126 return CredentialPattern{}, fmt.Errorf("failed to parse remote URL: %w", err)
127 }
128 return CredentialPatternFromHost(normalizedURL.Host), nil
129}
130
131// CredentialPatternFromHost expects host to be in the form "github.com" and returns
132// the credential pattern that should be used for it.

Callers 2

CloneMethod · 0.85

Calls 3

ParseURLFunction · 0.70
ErrorfMethod · 0.65

Tested by 1