Push origin master error on new repository

git, github

Solution

The error message leads to the conclusion that you do not have a `master` branch in your local repository. Either push your main development branch (`git push origin my-local-master:master` which will rename it to `master` on github) or make a commit first. You can not push a completely empty repository.

Problem

I just started using git with github. I followed their instructions and ran into errors on the last step. I'm checking in an existing directory that isn't currently source-controlled (project about a week old). Other than that, my use case should be pretty run of the mill. Here's what's happening: ``` $ git push origin master error: src refspec master does not match any. fatal: The remote end hung up unexpectedly error: failed to push some refs to 'git@github.com:{username}/{projectname}.git' ``` Github's instructions: ``` Global setup: Download and install Git git config --global user.name "Your Name" git config --global user.email {username}@gmail.com Next steps: mkdir projectname cd projectname git init touch README git add README git commit -m 'first commit' git remote add origin git@github.com:{username}/{projectname}.git git push origin master ```

Original source

Related problems