Hi I want to push something to specific remote branch
I make local areas by
git clone https://~~~.Something
cd https://~~~.Something
and I can access specific branch using
git checkout origin/[branch]
I want to commit something to my specific branch origin/[branch] But when I am trying to push something using by
git push origin [branch]
I got this error
error: src refspec [branch] does not match any.
error: failed to push some refs to 'https://github.com/kkammo/yonseitree.git'
I tried to solve this problem but I can't find any solution... so plz help me T.T
The solution to this error is to either create a local and remote master branch that you can push the commit to or to push the commit to an existing branch – maybe main . These commands will create a master branch locally. And by pushing to origin master , the master branch will also be created remotely.
The “src refspec master does not match any” error occurs if you have forgotten to add the files you have changed to a commit and try to push those changes to a remote repository before you make the first commit in your repository.
The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.
Git Push Origin pushes all the branches to the main branch. Git Push Origin Master pushes your master branch to the origin. Command for this: git push origin.
A replicated question here, src refspec master does not match any when pushing commits in git
Try git show-ref
to see what refs do you have. Is there refs/heads/[branch]?
You can try git push origin HEAD:[branch]
as more local-reference-independent solution.
It works for me.
Below is your now branch:
* dev
master
remotes/origin/master
The new branch dev
is created from master and have been done some commits.
Use the command below to push this new branch:
git push -u origin --tags HEAD:dev
After that, we check again:
* dev
master
remotes/origin/dev
remotes/origin/master
That's OK for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With