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

Function CredentialPatternFromGitURL

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

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

Calls 3

ParseURLFunction · 0.70
ErrorfMethod · 0.65