Skip to content

gh pr create now requires a default remote repository to be set, can't override on a per-PR basis #7216

@gibfahn

Description

@gibfahn

Describe the bug

gh --version
gh version 2.24.3 (2023-03-09)
https://github.com/cli/cli/releases/tag/v2.24.3

If I have the following configuration:

git remote -v
pub	https://github.com/bazelbuild/rules_docker/ (fetch)
pub	https://github.com/bazelbuild/rules_docker/ (push)
pubfork	https://github.com/gibfahn/rules_docker/ (fetch)
pubfork	https://github.com/gibfahn/rules_docker/ (push)
up	https://github.enterprise.com/bazelbuild/rules_docker/ (fetch)
up	https://github.enterprise.com/bazelbuild/rules_docker/ (push)
fork	https://github.enterprise.com/gibfahn/rules_docker/ (fetch)
fork	https://github.enterprise.com/gibfahn/rules_docker/ (push)

then there isn't a "default remote repository", the repo depends on the specific command I'm running. For creating PRs I'm creating the PR from the git @{push} ref to the @{upstream} branch ref, which could be fork -> up, or pubfork -> pub.

Previously I could do something like:

export GH_HOST=github.enterprise.com
export GH_REPO=https://github.enterprise.com/bazelbuild/rules_docker/
gh pr create

But now this is failing with:

X No default remote repository has been set for this directory.

please run `gh repo set-default` to select a default remote repository.

Expected vs actual behavior

I would like to go back to the previous behavior, where you could override the repo to use for gh pr create without needing to set a permanent default. I can work around this in my gh pr create wrapper, but it adds more complexity, and increases the chance that I'll run a different command against the wrong repo, due to a default I previously configured for a one-off use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions