I am very new with git so maybe this is a newbie question. I have a React project that I want to upload to GitHub, I already have my token and I've used Github-ClI in order to set up my account, so far I though everything worked just fine. I created a repository on my Github account, then using the Terminal I go to my project's folder and I try to upload it, at first I got an error: "origin already exists" so I remove such origin, and I try again, indeed something gets uploaded in my Github, but not that project, but the first project that I uploaded from the console when I first configured my token using Gihub-CLI. So the question is: How do I change that? How can I make it so the project that I want gets uploaded?
I am using Debian (Wsl) I've created my React app using npx create-react-app
Here the list of commands that I've used:
git remote add origin https://github.com/*****/******.git
git branch -M main
git push -u origin main
First I got
error: remote origin already exists.
Then I do:
git remote remove origin
then again :
git remote add origin https://github.com/******/******.git
git branch -M main
git push -u origin main
Here I don't get any error, just that another Project gets uploaded like I already said
CodePudding user response:
I solved the problem!! It was a silly mistake but it is hard to explain, for 2 reasons: 1) English is not my native language 2) I am very new with Git
So when I first configured github-cli I accidentally initialized Git in the Project folder, so all my project shared the same Branch (I am not sure if I am using the right term here) so I deleted the .git folder in my "Projects" folder and then I did the following in my App folder:
git init
That was all, everything works now