0

So I’ve installed git on my Linux machine, and tried to play with it on my local computer. The problem is that since the .git folder was generated in the home folder, every time I type "git status" it prints all the folders in the home folder as untracked files.

I tried to move the .git folder, but then git can't find it. So my question is, is it possible to change where git looks and generate my repository?

Thanks.

gturri
  • 13,807
  • 9
  • 40
  • 57
Or Nevo
  • 175
  • 1
  • 10

2 Answers2

1

I think you should not initialize a repo in /home, if you do that, it means that the repo is in your home directory, here is a example: enter image description here

As you can see, I git init a repo in my home directory, and all my files in my home directory belong to this repo I initialized just now.

SO,if you want to initialize a repo, you should mkdir your_repo_directory in you /home directory or other directory.

And if you want to remove the .git file, just rm -rf .git

On my machine, I remove the .git file enter image description here

And you can see there is no git repo in /home

If you have more question about remove the .git file. You can click here

Community
  • 1
  • 1
GoingMyWay
  • 16,802
  • 32
  • 96
  • 149
0

Judging by what you're asking, you may have initialized an empty repository in your home directory. If you didn't want to do that, then removing .git will remove the repo.