-1

I accidently initialized my Desktop directory as a local git repository using git init, how can I undeclare it to a normal directory without deleting any items in the same.

MrTux
  • 32,350
  • 30
  • 109
  • 146
  • 1
    Delete the hidden directory ".git". That's it. – Markus Feb 19 '18 at 11:17
  • 1
    Possible duplicate of [Uninitialize git repository](https://stackoverflow.com/questions/22540577/uninitialize-git-repository) – phd Feb 19 '18 at 11:28

2 Answers2

4

Git uses a .git directory to store the repository history and its meta data - from any directory Git tries to find a .git directory above the current directory (by default it stops at mount points) to determine whether the current directory is a working tree.

Just remove the .git directory on your desktop (the directory might be hidden as it starts with a dot; you can list it in a console using ls -la and remove it using rm -rf .git).

FLeX
  • 444
  • 4
  • 13
MrTux
  • 32,350
  • 30
  • 109
  • 146
0

In that case go to you command line

change your directory to the directory which you initialized git

Now if you do

ls -la

You will be able to see .git folder which is the main thing to keep track of your git project. To remove this you can use the following command

rm -rf .git
Channaveer Hakari
  • 2,769
  • 3
  • 34
  • 45