1

I'm running into an issue when I git push (Via CLI or Github Desktop) on Windows.

C:\code\MHPanel>git push origin develop
error: src refspec develop does not match any
error: failed to push some refs to 'https://github.com/Modern-Hosting/Panel.git'

I've tried deleting tags to no avail.

I've also tried remaking the local repo I have by doing

mkdir MHPanel
cd MHPanel
git init
git remote add origin https://github.com/Modern-Hosting/Panel.git

Then making a change (New file) and committing then pushing results in the same original error. Previously I was able to push to a different branch just fine until I removed the branch and switched back to this main develop branch. Others are able to push to the branch successfully. Branch is also private too.

Modern_Mo
  • 97
  • 8
  • If you change it to `git push -u origin develop` do things go any better? – matt Nov 23 '20 at 16:37
  • 2
    Does this answer your question? [Message 'src refspec master does not match any' when pushing commits in Git](https://stackoverflow.com/questions/4181861/message-src-refspec-master-does-not-match-any-when-pushing-commits-in-git) – matt Nov 23 '20 at 16:39
  • `git push -u origin develop` Doesn't fix the error. I'm not making use of master nor main. – Modern_Mo Nov 23 '20 at 17:37
  • 1
    @Modern_Mo Can you add the output of `git branch && git log -n1`? – Jeffrey Mixon Nov 23 '20 at 17:44
  • ```C:\code\MHPanel>git branch && git log -n1 * master commit 1e722b9f1881cf2d2113ce6cc2aba4591dc3e0e0 (HEAD -> master) Author: Modern Mo Date: Mon Nov 23 11:20:40 2020 -0500 add test file for fixing push``` – Modern_Mo Nov 24 '20 at 03:42

3 Answers3

1

After further looking through the branch, My colleague made a commit named refs/heads/develop Although you'd believe git tag -d refs/heads/develop to work, it didn't as the tag was already on the remote repository (pushed to github).

The solution was to go onto the github repo on github's website (Not CLI or Desktop) and deleting the tag & release with the name, then performing the local git tag deletion with git tag -d refs/heads/develop to work

Thank you for those who helped me find a solution!

Modern_Mo
  • 97
  • 8
0

This

error: src refspec develop does not match any

means that there is no local branch named develop which can be pushed to origin. Try creating the develop branch locally before pushing:

mkdir MHPanel
cd MHPanel
git init
git remote add origin https://github.com/Modern-Hosting/Panel.git
git touch newfile # or make changes
git commit -m 'Initial Commit'
git checkout -b develop # creating a local branch called "develop"
git push -u origin develop
Shell Code
  • 682
  • 4
  • 9
  • Sorry, I should have clarified, I got `src refspec develop does not match any` after deleting the ref file. Though I get `error: dst refspec refs/heads/develop matches more than one` when ran on fresh clone. I've also just reinstalled git & Github Desktop to no avail. Github Desktop works on other branches for pushing. – Modern_Mo Nov 24 '20 at 03:45
  • deleting the ref file? Not sure what that means. What about this answers suggestion to create a branch (the `git checkout -b develop` part ? – Michael Durrant Nov 26 '20 at 20:30
0

Please use the following command:

git push --set-upstream origin develop
Timothy G.
  • 6,335
  • 7
  • 30
  • 46