简体   繁体   中英

How to remove a git repository from a directory without deleting anything from it?

我不小心使用git init将Desktop目录初始化为本地git存储库,如何在不删除同一目录的情况下将其取消声明为普通目录。

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 ).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM