Error in command: "git push -u origin master"

It is the first time I am making a push request and I am following the BitBucket's tutorial here it is:

 ScreenClip.png

I followed all the steps here is the error:

error: src refspec master does not match any.
error: failed to push some refs to '<some url>'

2 answers

0 votes

What do you get from `git branch` ?

If you get "fatal: Not a git repository (or any of the parent directories): .git", but this is supposed to be a git repository, then you need to follow the "new project" guide instead of the "existing project" guide.

If you get "fatal: Not a git repository (or any of the parent directories): .git", but this is a Mercurial repository, then you'll need to make sure you add the repo URL to the [paths] section in .hg/hgrc, and then `hg push --new-branch` to create the appropriate structure on Bitbucket.

If you get a list of branches, but none is named "master", then you'll either need to push a different branch (`git push -u origin staging`, for example) or create a master branch (`git checkout -b master`) and then try pushing again.

If you get something else, then we can keep discussing here.

0 votes
areatype I'm New Here Dec 05, 2017

Adding this line:

git commit -m "initial commit"

Before this line:

git push origin master

 Solved the issue for me. 

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

631 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot