Git 正在忽略 .idea 文件夹,但这不在 gitignore 中 [英] Git is ignoring .idea folder, but that isn't in gitignore

查看:50
本文介绍了Git 正在忽略 .idea 文件夹,但这不在 gitignore 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 OSX.我有一个非常小的 .gitignore 文件,我什至尝试完全删除该文件.没有任何帮助.Git 在我的 .idea 目录下没有看到任何用于 intellij 的内容.

I'm on OSX. I have a very small .gitignore file, and I even tried completely deleting the file. Nothing helps. Git doesn't see anything under my .idea directory for intellij.

至少我想存储 .idea/runConfigurations/*.更糟糕的是,根据这篇文章所有该目录中的文件,但 1 或 2 应受源代码控制.

At the very least I want to store .idea/runConfigurations/*. Worse than that, according to this post, all the files in that directory but 1 or 2 should be source controlled.

是否有我不知道的额外隐藏 .gitignore 设置?如果是这样,有什么办法可以搜索并杀死它吗?

Is there an extra, hidden .gitignore setting somewhere I don't know about? Is there any way to search for and murder it if so?

我手动添加了最重要的:

I manually added the most important ones with:

git add .idea/runConfigurations -f

在没有 -f 的情况下尝试:

Trying that without the -f gave:

The following paths are ignored by one of your .gitignore files:
.idea
Use -f if you really want to add them.

重申:即使我完全删除了我的 .gitignore 文件,它也会出现该错误

To reiterate: it gave that error even when I completely deleted my .gitignore file

经过 SO 后,我设法找到了另一个线程 有同样的问题.不幸的是,即使原始海报回复问题仍未解决,它也被标记为已回答.无论如何,我的问题版本仍未解决

After raking through SO I managed to find one other thread having the same problem. Unfortunately it got marked as answered even though the original poster replied that the problem remained unsolved. Regardless, MY version of the problem remains unsolved

推荐答案

你有 ~/.gitignore 文件吗?这里是可能有用的信息.

Do you have ~/.gitignore file? Here is the information that may be helpful.

Git 有一个非常灵活的忽略文件层次结构:首先它读取你主目录中的 .gitignore 文件.将所有存储库的公共数据放在这里(例如,*.bak,您绝对不需要在任何存储库中使用它们).然后,您可以在存储库内的任何文件夹中拥有 .gitignore 文件.它会影响此文件夹及其子目录中的任何文件.此外,您可以在 .git/info/exclude 中排除.它与 .gitignore 不同,因为它没有被索引,你可以在这里放置个人设置.当然 ~/.gitignore 也没有被索引.

Git has a very flexible hierarchy of ignore files: First it reads .gitignore file in your home directory. Put here common data for all repos (*.bak, for example, you definitely do not need them in any repo). Then, you can have .gitignore file in any folder inside your repo. It impacts on any files in this folder and its subdirectories. Also, you can have excludes in .git/info/exclude. It differs from .gitignore because it is not indexed, and you can put personal settings here. Of course ~/.gitignore is not indexed too.

这篇关于Git 正在忽略 .idea 文件夹,但这不在 gitignore 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆