1

I clicked git init in my users folder by mistake, and then everything in my users folder has been turned with a blue question mark.

How can I fix this?

LF00
  • 27,015
  • 29
  • 156
  • 295
chitcha
  • 33
  • 1
  • 1
  • 5
  • `As I am totally new to IT`. Please see the guidelines for asking questions.http://stackoverflow.com/help/dont-ask – Aseem Goyal Apr 11 '15 at 06:00
  • [Is there a command to do undo git init](https://stackoverflow.com/q/3212459/6521116) – LF00 Jun 07 '17 at 09:34
  • 1
    Possible duplicate of [Is there a command to undo git init?](https://stackoverflow.com/questions/3212459/is-there-a-command-to-undo-git-init) – LF00 Jun 07 '17 at 09:35

2 Answers2

9

Check the Documentation About git init

When you run git init, a new .git folder its created on your project directory with some other subdirectories for objects, refs/heads, refs/tags , since its a dot file (.git)its hidden by default, so if you are running linux do the following.

 cd myFolder
 rm -rf .git

If you are running Windows, there are bunch of tutorials to show hidden files, like this for example

Ethaan
  • 11,291
  • 5
  • 35
  • 45
  • ok. but what if that folder already contains a folder with actual project file and and git settings. whether it will affect that too? – chitcha Apr 01 '15 at 02:39
  • When you run `git init`, you should something like reinitializing, so yes, the `commit`, `adds` should be reset but the `git --config` and other global configurations don't – Ethaan Apr 01 '15 at 02:41
  • 1
    Running git init in an existing repository is safe. It will not overwrite things that are already there. The primary reason for rerunning git init is to pick up newly added templates. from [docs](http://www.kernel.org/pub/software/scm/git/docs/git-init.html) – Ethaan Apr 01 '15 at 02:43
  • it works, thanks a ton. But it still remains in my libraries folder alone. i will check that too. But i dont find any.git folder in libraries!!!! – chitcha Apr 01 '15 at 02:46
  • 2
    saran nice to hear that, feel free to "accept" or "mark" this answer as accepted i see you are new here check out [this link](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) to know how to accept it, – Ethaan Apr 01 '15 at 02:50
2

Short and simple

rm -rf .git

Then, reinitialize as the right user

kiran puppala
  • 689
  • 8
  • 17