{"record":{"id":"aff8084976d1fe01","repo":"mislav/hub","slug":"no-git-remote-with-name-s","errorCode":null,"errorMessage":"No git remote with name %s","messagePattern":"No git remote with name (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"github/localrepo.go","lineNumber":52,"sourceCode":"\t\treturn err\n\t}\n\tr.remotes = remotes\n\n\treturn nil\n}\n\nfunc (r *GitHubRepo) RemoteByName(name string) (*Remote, error) {\n\tif err := r.loadRemotes(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, remote := range r.remotes {\n\t\tif remote.Name == name {\n\t\t\treturn &remote, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"No git remote with name %s\", name)\n}\n\nfunc (r *GitHubRepo) remotesForPublish(owner string) (remotes []Remote) {\n\tr.loadRemotes()\n\tremotesMap := make(map[string]Remote)\n\n\tif owner != \"\" {\n\t\tfor _, remote := range r.remotes {\n\t\t\tp, e := remote.Project()\n\t\t\tif e == nil && strings.EqualFold(p.Owner, owner) {\n\t\t\t\tremotesMap[remote.Name] = remote\n\t\t\t}\n\t\t}\n\t}\n\n\tnames := OriginNamesInLookupOrder\n\tfor _, name := range names {\n\t\tif _, ok := remotesMap[name]; ok {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/github/localrepo.go#L34-L70","documentation":"RemoteByName(name) loads the repo's remotes and scans them for one whose name matches exactly. If none matches, it returns this error. The library throws it because publishing/upstream lookups require a specifically named remote that does not exist locally.","triggerScenarios":"Calling RemoteByName(\"origin\") (or any name) via RemoteBranchAndProject, UpstreamProject, or remotesForPublish when `git remote -v` lists no remote with that exact name — typo, renamed remote, or no remotes configured at all.","commonSituations":"Remote renamed from 'origin' to a company convention (e.g. 'upstream', 'github'); fork workflows where only 'upstream'/'fork' exist; fresh clone with remotes removed; typo like 'originn'; multiple remotes where the requested one was deleted.","solutions":["Check `git remote -v` and use an existing remote name in the call/config","Add the missing remote: git remote add origin <url>","Rename an existing remote: git remote rename <old> <expected-name>","If this is a fork setup, configure remote.<name>.fetch/push URLs for the expected remote"],"exampleFix":"// before\ngit remote add upstream git@github.com:org/repo.git\nrepo.RemoteByName(\"origin\") // fails\n// after\nrepo.RemoteByName(\"upstream\") // matches configured remote\n// or\n// git remote rename upstream origin","handlingStrategy":"validation","validationCode":"out, _ := exec.Command(\"git\", \"remote\").Output()\nremoteNames := strings.Fields(string(out))\nhasOrigin := slices.Contains(remoteNames, \"origin\")\nif !hasOrigin { /* add remote or use another name */ }","typeGuard":null,"tryCatchPattern":"remote, err := repo.RemoteByName(\"origin\")\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"No git remote with name\") {\n        return fmt.Errorf(\"configure remote 'origin': git remote add origin <url>\")\n    }\n    return err\n}","preventionTips":["List `git remote -v` and confirm the expected remote name exists","Standardize remote naming across your team (origin/upstream conventions)","Set up remotes in bootstrap/setup scripts before running hub commands","Avoid hardcoding remote names; read from config with a fallback"],"tags":["git","remote-configuration","naming"],"backgroundTag":"missing-git-remote","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}