1

I'm trying to use git and GitHub.

I think I have set it up successfully (meaning that it is working).

However when I use the git status command I seem to get back all the files on my PC as untracked files (see the attached pic). I'm worried that if i use the commit command that all these files will be added to the repository in GitHub. I'm not quite sure what to do here, please could you advise me or point me in the right direction.

Screen Shot

2
  • 3
    What’s the output of git rev-parse --show-toplevel? Commented Sep 19, 2019 at 6:34
  • 2
    Looks like you've created a repo for your entire disk. Commented Sep 19, 2019 at 6:46

2 Answers 2

3

It seems you have created a repo for too many folders. Make sure you create a new repo (git init, git clone) only in your project folder.

For example, you create a new folder on your Desktop:

C:\Users\User1\Desktop\project

You go into the folder:

$ cd C:\Users\User1\Desktop\project

Then you create a new local git repo:

$ git init

Now everything in this folder will by tracked by git (unless you use .gitignore).

3
  • Yip - that's exactly what I did. It's all sorted out now. (Does the original repo with all the folders still exist? if so How can I cancell it - or does it not really matter?. Thank you for helping me out, and teaching me something new. Commented Sep 19, 2019 at 7:38
  • 2
    The bad repo is in C:\Users\back105, delete the .git directory there to get rid of it. Commented Sep 19, 2019 at 7:41
  • 1
    Just like @gronostaj said, all you need to do in order to delete a local repo is to delete .git folder. Commented Sep 19, 2019 at 10:46
1

use rm -fr .git to delete all the .git files and after go to your file and type git init

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.