-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinggh-prrelating to the gh pr commandrelating to the gh pr commandhelp wantedContributions welcomeContributions welcomep3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Description
Describe the bug
gh pr create fails with error: dst refspec main matches more than one when local and remote repositories have a branch and a tag with the same name. git push --set-upstream origin main succeeds in the same scenario, indicating a potential issue in how gh handles refspecs. gh version: [insert your gh version here].
Steps to reproduce the behavior
- In a local repo, have a branch and a tag named
main. - Ensure the remote (GitHub) repo also has a branch and a tag named
main. - Try creating a PR with
gh pr create --title "Example" -F example.txt. (to an upstream remote, but for this bug report, it doesn't matter if the upstream has the samemainbranch andmaintag conflict) - Observe the error:
error: dst refspec main matches more than one.
Expected vs actual behavior
Expected: gh pr create should handle the branch and tag naming conflict as gracefully as git push, creating the PR without errors.
Actual: The command fails with error: dst refspec main matches more than one.
Logs
Failure:
gh pr create --title "ci: Use GITHUB_OUTPUT envvar instead of set-output command" -F ~/Downloads/prbody.txt
? Where should we push the 'main' branch? Create a fork of microsoft/azure-schema-operator
Creating pull request for arunsathiya:main into main in microsoft/azure-schema-operator
error: dst refspec main matches more than one
error: failed to push some refs to 'github.com:arunsathiya/azure-schema-operator.git'
waiting 2 seconds before retrying...
error: dst refspec main matches more than one
error: failed to push some refs to 'github.com:arunsathiya/azure-schema-operator.git'
waiting 2 seconds before retrying...
error: dst refspec main matches more than one
error: failed to push some refs to 'github.com:arunsathiya/azure-schema-operator.git'
waiting 2 seconds before retrying...
error: dst refspec main matches more than one
error: failed to push some refs to 'github.com:arunsathiya/azure-schema-operator.git'
waiting 2 seconds before retrying...
failed to run git: exit status 1What worked:
git push --set-upstream origin main
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 674 bytes | 674.00 KiB/s, done.
Total 5 (delta 4), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
To github.com:arunsathiya/azure-schema-operator.git
6b65409..8a98674 main -> main
branch 'main' set up to track 'origin/main'.
gh pr create --title "ci: Use GITHUB_OUTPUT envvar instead of set-output command" -F ~/Downloads/prbody.txt
Creating pull request for arunsathiya:main into main in microsoft/azure-schema-operator
https://github.com/microsoft/azure-schema-operator/pull/26Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggh-prrelating to the gh pr commandrelating to the gh pr commandhelp wantedContributions welcomeContributions welcomep3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic