1

So currently I am trying to learn Git and am having a little trouble although many tutorials seem to be thorough and consistent.

When I type git init I get /Users/{username}/.git/ which seems to be ok since the tutorials also return the same path.

But when I type git status I get every file and folder (both hidden and non hidden) that is in my /Users/{username}/ directory for some reason, and it says all of those files/folders are untracked.

I don't want those files/folders in there as I only want my .git folder to contain my projects so I can proceed learning how to push projects into my remote repository (GitHub).

My system is Mac OSX, with OSX Sierra installed.

Scott Weldon
  • 9,673
  • 6
  • 48
  • 67
  • "When I type `git init` I get `/Users/username/.git/` which seems to be ok since the tutorials also return the same path." That's almost certainly not what you want. Running `git init` from your [home directory](https://en.wikipedia.org/wiki/Home_directory) will make your entire home directory a Git repository. Git allows you to do that because it's a completely valid thing, but, again, not what you want. You will want to make a new directory for a particular project and run `git init` inside that directory. – Whymarrh Feb 07 '17 at 23:17

1 Answers1

2

This is expected behavior. As you note:

it says all of those files/folders are untracked.

This means those files are not in the Git repo, Git is only telling you that there are files that may be added.

While you can work from your $HOME directory if you want, I wouldn't advise it. Instead, create a new folder just for your repo, and do your work there:

mkdir my-git-repo
cd my-git-repo
git init

To clean up the old Git repo, you can just delete it:

rm ~/.git
Scott Weldon
  • 9,673
  • 6
  • 48
  • 67