简体   繁体   English

从主目录中删除git(使用终端/命令行)

[英]Deleting git from home directory (Using Terminal/Command Line)

Somehow I must have initiated a git at my home directory because now when I type 'git status,' I'm getting a whole list of of 'untracked files' which include my personal folders for my computer that have nothing to do with Github (Pictures, Downloads, Documents, Desktop, etc...). 不知何故,我必须在我的主目录中启动一个git,因为现在当我输入'git status'时,我得到了一个'未跟踪文件'的完整列表,其中包括我的计算机的个人文件夹,与Github无关(图片,下载,文档,桌面等...)。

When I type ls -a at my 'root' (for me, it's at /Users/(my name) ), I am seeing .git which means I have a git directory here and am not supposed to. 当我在'root'中输入ls -a (对我而言,它位于/Users/(my name) )时,我看到了.git ,这意味着我在这里有一个git目录,我不应该这样做。 I found a related question on stack overflow below - my follow up to this question is, since I have folders within my home drive that are legitimate git repos and that I do want to keep, I want to make sure I'm not deleting those with the recursive rm . 我在下面发现了一个关于堆栈溢出的相关问题 - 我对这个问题的跟进是,因为我的家庭驱动器中的文件夹合法的git repos并且我确实想要保留,我想确保我不删除那些与递归rm

I am a super newbie, so it's difficult for me to know what I should even be searching for. 我是一个超级新手,所以我很难知道我应该搜索什么。 I've spent a few hours on this already with little progress. 我已经花了几个小时就已经没有进展了。 Another possible solution I've found is to add my home drive to gitignore, but it would be even better if I could completely remove the '.git' from my home folder completely. 我发现的另一个可能的解决方案是将我的主驱动器添加到gitignore,但如果我可以完全从我的主文件夹中删除'.git',那就更好了。

Related: How to undo git init on a home directory? 相关: 如何在主目录上撤消git init?

Just remove the .git folder from your home directory. 只需从主目录中删除.git文件夹即可。

rm -rf ~/.git will only remove the .git folder that lives directly within your home folder. rm -rf ~/.git只会删除直接位于主文件夹中的.git文件夹。 It will not touch any other git repositories you may have in other locations within your home folder. 它不会触及您在主文件夹中的其他位置可能具有的任何其他git存储库。

rm -rf ~/.git是我在mac计算机上使用的命令,它确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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