Skip to main content
2 of 4
improved answer and formatting
Aswin Barath
  • 1.1k
  • 11
  • 15

Problem faced

I had the same problem when I was creating a new repository on GitHub and linking it with my react-app in the client computer I have.

I used the following steps:

Commands used before the problem

git init git commit -m "first commit" git branch -M main git remote add origin "_git repository link here_" git push -u origin main 

My mistake

But as you can see my mistake was not using the git add . command I did this mistake because I already had README.md file and GitHub instructs us with basic commands while creating the repository.

My solution

My solution is to use git add . after git init command.

Use the following set of commands in the same order to overcome the problem:

git init git add . git commit -m "first commit" git branch -M main git remote add origin "_git repository link here_" git push -u origin main 
Aswin Barath
  • 1.1k
  • 11
  • 15