MCPcopy Create free account
hub / github.com/github/gh-aw / getHostFromOriginRemote

Function getHostFromOriginRemote

pkg/cli/git.go:203–213  ·  view source on GitHub ↗

getHostFromOriginRemote returns the hostname of the git remote. It prefers the 'origin' remote for backward compatibility. If 'origin' is not configured but exactly one other remote exists, that remote is used instead. For example, a remote URL of "https://ghes.example.com/org/repo.git" returns "ghe

()

Source from the content-addressed store, hash-verified

201// and "git@github.com:owner/repo.git" returns "github.com".
202// Returns "github.com" as the default if the remote URL cannot be determined.
203func getHostFromOriginRemote() string {
204 remoteURL, remoteName, err := resolveRemoteURL("")
205 if err != nil {
206 gitLog.Printf("Failed to resolve remote URL: %v", err)
207 return "github.com"
208 }
209
210 host := extractHostFromRemoteURL(remoteURL)
211 gitLog.Printf("Detected GitHub host from remote %q: %s", remoteName, host)
212 return host
213}
214
215// getRepositorySlugFromRemote extracts the repository slug (owner/repo) from git remote URL.
216// It prefers the 'origin' remote for backward compatibility. If 'origin' is not

Callers 13

detectGHESDeploymentFunction · 0.85
RunAddInteractiveFunction · 0.85
CompileWorkflowsFunction · 0.85
createPRFunction · 0.85
listOpenOrgItemsFunction · 0.85
addLabelToOrgPRFunction · 0.85
createOrgIssueFunction · 0.85
resolveAuditHostnameFunction · 0.85
RunAuditDiffFunction · 0.85

Calls 3

resolveRemoteURLFunction · 0.85
extractHostFromRemoteURLFunction · 0.85
PrintfMethod · 0.45

Tested by 1