MCPcopy Create free account
hub / github.com/cli/cli / CredentialPatternFromGitURL

Function CredentialPatternFromGitURL

git/client.go:124–130  ·  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

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