{"record":{"id":"f68466a9872f8905","repo":"mislav/hub","slug":"can-t-find-remote-for-s","errorCode":null,"errorMessage":"Can't find remote for %s","messagePattern":"Can't find remote for (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/pull_request.go","lineNumber":244,"sourceCode":"\t\tTitle:    \"pull request\",\n\t}\n\n\tbaseTracking := base\n\theadTracking := head\n\n\tremote := baseRemote\n\tif remote != nil {\n\t\tbaseTracking = fmt.Sprintf(\"%s/%s\", remote.Name, base)\n\t}\n\tif remote == nil || !baseProject.SameAs(headProject) {\n\t\tremote, _ = localRepo.RemoteForProject(headProject)\n\t}\n\tif remote != nil {\n\t\theadTracking = fmt.Sprintf(\"%s/%s\", remote.Name, head)\n\t}\n\n\tif flagPullRequestPush && remote == nil {\n\t\tutils.Check(fmt.Errorf(\"Can't find remote for %s\", head))\n\t}\n\n\tmessageBuilder.AddCommentedSection(fmt.Sprintf(`Requesting a pull to %s from %s\n\nWrite a message for this pull request. The first block\nof text is the title and the rest is the description.`, fullBase, fullHead))\n\n\tflagPullRequestMessage := args.Flag.AllValues(\"--message\")\n\tflagPullRequestEdit := args.Flag.Bool(\"--edit\")\n\tflagPullRequestIssue := args.Flag.Value(\"--issue\")\n\tif !args.Flag.HasReceived(\"--issue\") && args.ParamsSize() > 0 {\n\t\tflagPullRequestIssue = parsePullRequestIssueNumber(args.GetParam(0))\n\t}\n\n\tif len(flagPullRequestMessage) > 0 {\n\t\tmessageBuilder.Message = strings.Join(flagPullRequestMessage, \"\\n\\n\")\n\t\tmessageBuilder.Edit = flagPullRequestEdit\n\t} else if args.Flag.HasReceived(\"--file\") {","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/pull_request.go#L226-L262","documentation":"gh pulls the head branch's tracking remote to build the \"from\" side of a pull request. When `--push` is requested but no remote that tracks the head branch exists, `remote` is nil and pullRequest aborts with this error, since pushing to create the head ref is impossible without a remote.","triggerScenarios":"Running `gh pr create --push` (flagPullRequestPush true) while `remote` resolved to nil — i.e. the current branch has no configured tracking remote / no remote named matching the head ref in the repository config.","commonSituations":"Branch created locally without ever pushing it and without an upstream set; repo has a single 'origin' but config points the branch tracking elsewhere; remotes were renamed or removed after cloning.","solutions":["Set an upstream for the branch: git branch --set-upstream-to=<remote>/<branch>, or push once with `git push -u origin <head>` then rerun.","Run without `--push` after pushing the branch manually with git push -u.","Verify remotes with `git remote -v` and re-add the missing remote (`gh repo set-default` / `git remote add origin ...`)."],"exampleFix":"// before (branch has no tracking remote)\ngh pr create --push\n// after\ngit push -u origin feature-branch\ngh pr create --push","handlingStrategy":"validation","validationCode":"remote := git.RemoteForBranch(head)\nif remote == nil {\n    fmt.Println(\"no tracking remote for\", head, \"— run: git push -u origin\", head)\n    os.Exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always push new branches with -u to set upstream tracking.","Run `git remote -v` before scripted PR creation.","Avoid --push in scripts unless the branch is known to have an upstream."],"tags":["git","remote","pull-request","cli"],"backgroundTag":"missing-git-remote","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}