`git status` command error

Hello everyone, any help would be appreciated.

after cd into one of my local folders I typed the git status command to see the unstage files, what I don’t understand is why is it listing the entire Desktop directory when I never cd into it?

any advice or recommendation is appreciated

it depends on where you initialized the git repo, are you sure you did it in the folder of the project? if you didn’t, it is probably tracking your whole computer, and that’s not good

@ieahleen
yes, this is the only folder I initialized but it’s tracking the entire computer and I can’t seem to understand why

I tried with other folders and those seem to be working fine but this one is giving the same response for a while now

@RandellDawson
first, I right clicked on the folder and opened the terminal that way

then, I cd into the project folder using the terminal

after this, I used git status to view the unstaged files inside and that’s when it listed all the folder in the computer

@camperextraordinaire
no, I didn’t run git init

@RandellDawson

yes, it’s at the bottom on the picture

Run rm -rf .git to remove that folder. Then change back into the freecodecamp folder and run git status.

2 Likes

@camperextraordinaire

this is the result

does this mean git was tracking all folders all this time?

@camperextraordinaire this is the result

does it look good now?

thank you @camperextraordinaire

so I’m guessing that the error was that git was initilized on the entire computer instead of the one folder I am working on.
is that right?

1 Like

Yep that’s exactly it! It’s a pretty common mistake to accidentally run git init or even accidently clone another repo in the wrong directory. I do it all the time :sweat_smile:

Once you do this once though, you’ll never forget how to fix this problem!

1 Like

:joy:
I was struggling the whole day yesterday to get this working and it kept on giving me red flags every time

anyways, I’m glad I posted this issue here to get some support

really appreciate everyone’s support and encouragement

1 Like

not a problem at all

that was really helpful,

I learn’t something new today which is a bonus

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.