Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

src refspec ~ does not match any

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

like image 816
kwony Avatar asked Nov 02 '14 16:11

kwony


People also ask

How do you fix SRC Refspec main does not match any?

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.

What does SRC Refspec master does not match any mean?

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.

What is push command in git?

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.

What is git push origin?

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.


2 Answers

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.

like image 82
Luna Kong Avatar answered Sep 22 '22 17:09

Luna Kong


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.

like image 21
JsonBruce Avatar answered Sep 19 '22 17:09

JsonBruce