[git] Git error: src refspec master does not match any error: failed to push some refs

I am trying to add a file to my repository on BitBucket and I am having trouble.

I am using GIT and this is what I type in

$ cd lis4368/assignments
$ git remote
$ git remote -v
$ git remote rm origin

and then I type this in (this is what BitBucket tells me to enter)

$ git remote add origin https://[email protected]/cpb09e/cpb09e.git
$ git push -u origin master

And I keep getting this error message:

error: src refspec master does not match any.
error: failed to push some refs to 'https://[email protected]/cpb09e/cpb09e.git'

Can someone pleas help me out? I have tried everything from git commit to rm -rf * and I cannot get anything to work at all.

This question is related to git bitbucket git-push refspec

The answer is


It doesn't recognize that you have a master branch, but I found a way to get around it. I found out that there's nothing special about a master branch, you can just create another branch and call it master branch and that's what I did.

To create a master branch:

git checkout -b master

And you can work off of that.


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to bitbucket

How to markdown nested list items in Bitbucket? Your configuration specifies to merge with the <branch name> from the remote, but no such ref was fetched.? Bitbucket git credentials if signed up with Google What I can do to resolve "1 commit behind master"? Bitbucket fails to authenticate on git pull Change remote repository credentials (authentication) on Intellij IDEA 14 git: updates were rejected because the remote contains work that you do not have locally How do I push a local repo to Bitbucket using SourceTree without creating a repo on bitbucket first? Clone private git repo with dockerfile How to move git repository with all branches from bitbucket to github?

Examples related to git-push

Fix GitLab error: "you are not allowed to push code to protected branches on this project"? ! [rejected] master -> master (fetch first) Git - What is the difference between push.default "matching" and "simple" error: src refspec master does not match any Issue pushing new code in Github Can't push to GitHub because of large file which I already deleted Changing the Git remote 'push to' default What does '--set-upstream' do? Git push hangs when pushing to Github? fatal: 'origin' does not appear to be a git repository

Examples related to refspec

Git error: src refspec master does not match any error: failed to push some refs