Main Problem
Pushing an Empty Repo unknowingly
The main course of this issue is publishing an empty repo to non existing branch. Mostly, one tend to create a git repo by following git autogenerated procure while skipping to commit. As referenced, we failed to commit README.md file.
$ git init
$ git add README.md
$ git branch -M main
$ git remote add origin https://github.com/profile/repository.git
$ git push -u origin main
Quick fix
One can resolve this issues by committing all the files immediately adding.
$ git init
$ git add .
$ git branch -M main
$ git add .
$ git commit -m "message"
$ git remote add origin https://github.com/profile/repository.git
$ git push -u origin main
...and would save lots of time, keep giting!
Top comments (0)