I'm really new to GitHub.
I made my first project and want to add it to GitHub. But when I try to add my project to GitHub I'm getting the following error and I couldn't find a way to fix it.
git branch -M main
error: refname refs/heads/new_branch not found
fatal: Branch rename failed
Any help will be appreciated.
git branch -M
is for renaming a branch.
If makes sense if you have a current master
branch that you want to rename as main
.
Make sure that your new local project has:
master
branchgit push -u origin master
I solved this thanks to this guide,
Apparently and I do not know why the steps given by the Github guide are not in the correct order and if I am wrong that someone please explain to me.
I solved it with these steps:
git init
git remote add origin [email protected]:<YOUR_REPOSITORY_ADDRESS>
git add .
git commit -m "first commit"
git branch -M main
git push -u origin main
steps that the guithub guide gives that for me was a mistake.
echo "# socialdata" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/<YOUR_REPOSITORY_ADDRESS>
git push -u origin main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With