0

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

  • 1
    Please include specific details about what commands you are using and what the exact error messages are. As an example, "try to upload it" could mean many different things, and it's impossible to tell you what you're doing wrong without knowing what actual commands correspond to your understanding of what "uploading" is. – Daniel Mann Nov 17 '22 at 23:00
  • 1
    I will, I mean, i just copy and paste the command fro github – Giovanni El Zelah Nov 17 '22 at 23:02

1 Answers1

1

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