How to solve this problem of "! [rejected] master -> master (fetch first)"

How to solve this problem of "! [rejected] master -> master (fetch first)"
First Do this ...
git fetch origin master
git merge master
Then, do this ...
git fetch origin master:tmp
git rebase tmp
git push origin HEAD:master
git branch -D tmp
Now everything works well.


OR:

git fetch origin master:tmp
git rebase tmp
git push origin HEAD:master
git branch -D tmp
Error: Message 'src refspec master does not match any' when pushing commits in Git
git init
git add .
git commit -m 'message'
git *create remote
git push -u origin master
OR
git checkout -b master
git add .
git commit -m "my commit message"
git push origin master

Post a Comment