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.
Asked
Active
Viewed 434 times
-1

MrTux
- 32,350
- 30
- 109
- 146

Rishabh Kanwar
- 25
- 1
- 5
-
1Delete the hidden directory ".git". That's it. – Markus Feb 19 '18 at 11:17
-
1Possible duplicate of [Uninitialize git repository](https://stackoverflow.com/questions/22540577/uninitialize-git-repository) – phd Feb 19 '18 at 11:28
2 Answers
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
).
-
Sorry didnt see your answer coming. Cheers. Really appreciate. – Channaveer Hakari Feb 19 '18 at 11:11
-
@rishabh-kanwar Please consider accepting this answer if it helped you. That is the way to say thank you on stackoverflow. – MrTux Apr 09 '18 at 17:56
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