Repository navigation
dst refspec main matches more than one when remote has a main branch and a main tag #8572
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workinggh-prrelating to the gh pr commandrelating to the gh pr commandhelp wantedContributions welcomeContributions welcomepriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Description
Activity
@arunsathiya That is a good catch. I tracked down the bug to this line. The refspec we are providing to
git pushis a bit ambiguous in this situation and we should specify it asHEAD:refs/heads/BRANCHNAMEinstead ofHEAD:BRANCHNAME.- addedpriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetichelp wantedContributions welcomeContributions welcomegh-prrelating to the gh pr commandrelating to the gh pr commandand removedneeds-triageneeds to be reviewedneeds to be reviewed
on Jan 16, 2024 Just for my own reference I reproduced this here:
➜ test-repo git:(heads/main) ✗ git checkout -b 8572-triage Switched to a new branch '8572-triage' ➜ test-repo git:(8572-triage) ✗ git tag 8572-triage ➜ test-repo git:(heads/8572-triage) ✗ git push --tags Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 ^[[ATo https://github.com/williammartin/test-repo.git * [new tag] 8572-triage -> 8572-triage ➜ test-repo git:(heads/8572-triage) ✗ git push -u origin heads/8572-triage Total 0 (delta 0), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for '8572-triage' on GitHub by visiting: remote: https://github.com/williammartin/test-repo/pull/new/8572-triage remote: To https://github.com/williammartin/test-repo.git * [new branch] 8572-triage -> 8572-triage branch '8572-triage' set up to track 'origin/8572-triage'. ➜ test-repo git:(heads/8572-triage) ✗ touch a && git add . && git commit -m "add triage file" [8572-triage ccc6ba3] add triage file 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a create mode 100644 example.txt ➜ test-repo git:(heads/8572-triage) gh pr create --title "Example" -F example.txt ? Where should we push the '8572-triage' branch? williammartin/test-repo Creating pull request for 8572-triage into main in williammartin/test-repo error: dst refspec 8572-triage matches more than one error: failed to push some refs to 'https://github.com/williammartin/test-repo.git'
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggh-prrelating to the gh pr commandrelating to the gh pr commandhelp wantedContributions welcomeContributions welcomepriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Describe the bug
gh pr createfails witherror: dst refspec main matches more than onewhen local and remote repositories have a branch and a tag with the same name.git push --set-upstream origin mainsucceeds in the same scenario, indicating a potential issue in howghhandles refspecs.ghversion: [insert your gh version here].Steps to reproduce the behavior
main.main.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)error: dst refspec main matches more than one.Expected vs actual behavior
Expected:
gh pr createshould handle the branch and tag naming conflict as gracefully asgit push, creating the PR without errors.Actual: The command fails with
error: dst refspec main matches more than one.Logs
Failure:
What worked: