Push origin master error on new repository

I had the same issue. I deleted the .git folder then followed the following commands

  1. $ git init
  2. $ git add .
  3. $ git remote add origin [email protected]:project/project.git
  4. $ git commit -m "Initial version"
  5. $ git push origin master

I was having the same issue and then smacked myself in the head because I hadn't actually added my project files.

git add -A
git commit -am "message"
git push origin master

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.

Tags:

Git

Github