Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: error: src refspec master does not match any [duplicate]

Tags:

git

After cloning git repository to directory "hggit" and setting the remote origin with

mbm:hggit my name$ git remote add origin [email protected]:"mystringhere"

After editing files I committed the changes (while located in a sub-dir) with

mbm:handelgroup michaelmausler$ git commit -m "first commit"
[master 5a29bc8] first commit
 1 files changed, 2 insertions(+), 2 deletions(-)

I then attempted to push file changes and received the following error

mbm:hggit myname$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to '[email protected]:"mystringhere"'
like image 533
Alex Borsody Avatar asked May 13 '12 01:05

Alex Borsody


People also ask

How do I fix error SRC Refspec master 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 is git push origin master?

Origin is simply the name given to any remote repository available on GitHub. Whenever we need to push the changes to a remote repository, we use git push along with the remote repository “origin” and “master” branches. The term used is “git push origin master“.

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.

What is the 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.


1 Answers

use git branch -m to rename your local repository to have the same name you want to push to the remote

like image 97
Gal Bracha Avatar answered Oct 05 '22 04:10

Gal Bracha