{"record":{"id":"7fce3eb1a8a031ef","repo":"mislav/hub","slug":"aborted-could-not-find-any-git-remote-pointing-to","errorCode":null,"errorMessage":"Aborted: could not find any git remote pointing to a GitHub repository","messagePattern":"Aborted: could not find any git remote pointing to a GitHub repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github/localrepo.go","lineNumber":256,"sourceCode":"\nfunc (r *GitHubRepo) MainRemote() (*Remote, error) {\n\tr.loadRemotes()\n\n\tif len(r.remotes) > 0 {\n\t\treturn &r.remotes[0], nil\n\t}\n\treturn nil, fmt.Errorf(\"no git remotes found\")\n}\n\nfunc (r *GitHubRepo) MainProject() (*Project, error) {\n\tr.loadRemotes()\n\n\tfor _, remote := range r.remotes {\n\t\tif project, err := remote.Project(); err == nil {\n\t\t\treturn project, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"Aborted: could not find any git remote pointing to a GitHub repository\")\n}\n\nfunc (r *GitHubRepo) CurrentProject() (project *Project, err error) {\n\tproject, err = r.UpstreamProject()\n\tif err != nil {\n\t\tproject, err = r.MainProject()\n\t}\n\n\treturn\n}\n\nfunc (r *GitHubRepo) UpstreamProject() (project *Project, err error) {\n\tcurrentBranch, err := r.CurrentBranch()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tupstream, err := currentBranch.Upstream()","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/localrepo.go#L238-L274","documentation":"MainProject() iterates all remotes trying remote.Project(), which parses the remote URL into a GitHub Project. If every remote either fails to parse or is not a recognized GitHub repository, this error is returned. CurrentProject falls back to MainProject after UpstreamProject fails, so this surfaces when no remote is GitHub-based.","triggerScenarios":"Calling MainProject() (via CurrentProject) when all remotes point at non-GitHub hosts (GitLab, Bitbucket, bare file paths) or their URLs cannot be parsed as GitHub projects at all.","commonSituations":"Working on a GitLab/Bitbucket mirror but running hub commands; remotes configured as plain local paths or unresolvable SSH aliases; GHE host not configured so URLs aren't recognized; typo in remote URL.","solutions":["Add a remote pointing at a GitHub (or GitHub Enterprise) repository","Fix remote URLs so they parse as GitHub URLs: git remote set-url origin git@github.com:owner/repo.git","If using GitHub Enterprise, configure the enterprise host so its URLs are recognized","Verify with `git remote -v` that at least one URL is a github.com/GHE URL"],"exampleFix":"// before\ngit remote set-url origin https://gitlab.com/org/repo.git\np, err := repo.CurrentProject() // Aborted: ...\n// after\ngit remote set-url origin https://github.com/org/repo.git\np, err := repo.CurrentProject() // works","handlingStrategy":"try-catch","validationCode":"out, _ := exec.Command(\"git\", \"remote\", \"get-url\", \"origin\").Output()\norigin := strings.TrimSpace(string(out))\nif !strings.Contains(origin, \"github.com\") { // or your GHE host\n    // remote is not GitHub-based; hub operations will fail\n}","typeGuard":null,"tryCatchPattern":"project, err := repo.CurrentProject()\nif err != nil {\n    if strings.Contains(err.Error(), \"could not find any git remote pointing to a GitHub repository\") {\n        return nil, fmt.Errorf(\"this repo has no GitHub remote; set origin to a github.com URL\")\n    }\n    return nil, err\n}","preventionTips":["Only use this library on repos with at least one GitHub/GHE remote","Set remote URLs to git@github.com:owner/repo.git or https://github.com/owner/repo.git","Configure your GitHub Enterprise host if using GHE","Detect GitLab/Bitbucket remotes early and route to the right tooling instead"],"tags":["git","github","remote-configuration","url-parsing"],"backgroundTag":"no-github-remote","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}