Skip to content

gh pr create --web fails if branch name contains a forward slash #10857

Description

@pdunnavant

Describe the bug

I have a branch created with a name of TICKET/test-name. In github-cli versions prior to 2.71.0, gh pr create --web worked successfully. As of 2.71.0, the command fails with an error:

➜ gh pr create --web
remote tracking branch must have format refs/remotes/<remote>/<branch> but was: refs/remotes/origin/TICKET/test-name

Affected version

Please run gh version and paste the output below.

➜ gh version
gh version 2.71.0 (2025-04-23)

Steps to reproduce the behavior

  1. Create a branch with a name containing a forward slash.
  2. Run gh pr create --web
  3. See error

Expected vs actual behavior

I'd expect the PR to be created successfully.

Logs

➜ GH_DEBUG=true gh pr create --web
[git remote -v]
[git config --get-regexp ^remote\..*\.gh-resolved$]
* Request at 2025-04-24 15:06:27.579786 +0900 JST m=+0.115545042
* Request to https://api.github.com/graphql
* Request took 749.412042ms
[git status --porcelain]
[git symbolic-ref --quiet HEAD]
[git config --get-regexp ^branch\.TICKET/test-name\.(remote|merge|pushremote|gh-merge-base)$]
[git rev-parse --symbolic-full-name TICKET/test-name@{push}]
[git config push.default]
[git config remote.pushDefault]
[git show-ref --verify -- HEAD refs/remotes/origin/TICKET/test-name]
remote tracking branch must have format refs/remotes/<remote>/<branch> but was: refs/remotes/origin/TICKET/test-name

Activity

  1. williammartin commented on Apr 24, 2025

    @williammartin
    Member

    Thanks @pdunnavant, we did a lot work around resolving the push target and I made a silly assumption when parsing remote refs. I think we'll do a new release asap.

  2. added
    gh-prrelating to the gh pr command
    priority-1Affects a large population and inhibits work
    on Apr 24, 2025
  3. added
    coreThis issue is not accepting PRs from outside contributors
    and removed on Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreThis issue is not accepting PRs from outside contributorsgh-prrelating to the gh pr commandpriority-1Affects a large population and inhibits work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions