【问题标题】:Android Eclipse: .gitignore not ignoring bin and gen directories at all [duplicate]Android Eclipse:.gitignore 根本不忽略 bin 和 gen 目录[重复]
【发布时间】:2013-11-15 20:49:18
【问题描述】:

我试图忽略一些与推送无关的 Eclipse 生成文件,这是我的文件夹结构:

Project1/
   .gitignore
   extras/
      ..some stuff here
   Project1/
      bin
      gen
      libs
      res
      ..and so forth

所以我需要位于外部 Project1 内部的内部 Project1,因为 Eclipse 因没有这样的文件夹结构而变得疯狂,它不会导入我的项目,就是这样。 git ignore 似乎适用于 extras 文件夹,但不适用于 bin、gen 或内部 Project1 文件夹中的任何内容。我尝试添加像 Project1/bin 这样的文件夹,但没有任何变化,而且 git 仍然注意到更改。

这是我的文件:

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin
gen
extras

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project
project.properties

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/

这是我的第一个 android github 项目,所以我还在学习中。如果我的问题或假设是错误的,请不要介意。谢谢!

【问题讨论】:

  • 您找到解决方案了吗?我也被困在这个问题上。
  • @AjayGautam,不幸的是没有。我切换到 Android Studio 以解决问题..
  • @AjayGautam,这就是解决方案。我需要从 git 的缓存中删除文件夹/项目,因为我的仓库中已经有该文件夹。如果它是一个 pre gitignore 文件夹/文件,则需要将其从缓存中删除。如果你在 gitignore 中添加了一些东西,但你还没有将它推送到 git,那么它应该会自动忽略它,因为它还没有被缓存。

标签: android eclipse git github gitignore


【解决方案1】:

尝试将bin 更改为Project1\bin\**,同样将gen 更改为Project1\gen\**。

【讨论】:

  • 是的,我试过了,但它根本不起作用。
  • 这很奇怪。您的 .git 文件夹位于外部 Project1 目录中,对吧?
  • 是的,最外面的。它与 extras 文件夹和内部 project1 文件夹一起在哪里
  • 刚刚注意到 bin 或 gen 前面没有 /。使用 bin/ 和 gen/
  • 再次检查你的 gitignore 配置。如果你有最新版本的 git,那么 bin/ 应该可以工作:)。在最坏的情况下,重组您的项目可能不是一个坏主意。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-31
  • 2017-09-19
  • 2021-07-27
  • 2014-07-22
相关资源
最近更新 更多