【问题标题】:Netbeans and Git, .obj files ignoredNetbeans 和 Git,.obj 文件被忽略
【发布时间】:2015-03-20 07:29:20
【问题描述】:

我正在处理一个涉及 .obj 文件的小型 git 项目。

当我查看“项目选项卡”时,我发现它们被忽略了

但我不明白为什么,如果我查看我的 .gitignore:

/DepthPeeling/nbproject/private/
/DepthPeeling/dist/
/DepthPeeling/build/

看起来不错

如果我打开一个 Git Bash 并输入

$ git add dragon.obj
The following paths are ignored by one of your .gitignore files:
DepthPelling/sry/depthPeeling/data/dragon.ogj
Use -f if you really want to add them.
fatal: no file added

什么?

可能有多个 .gitignore 文件吗?如果我寻找它们,我只会在项目本身的根目录中找到一个(我之前显示的那个),仅此而已..

编辑:所以看起来我有一个全局忽略 D:\Documents\gitignore_global.txt

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.dll
*.lib
*.sbr

【问题讨论】:

  • 是的,每个目录中都可以有一个.gitignore ignored files can be specified in other ways。试试find <repo> -name .gitignorecat <repo>/info/exclude
  • 你能在你的项目中搜索其他.gitignore文件吗?从您的屏幕截图来看,您似乎正在运行 Windows。
  • @TimBiegeleisen 我刚刚使用了窗口浏览器

标签: git github gitignore netbeans-8


【解决方案1】:

您可以使用git check-ignore 轻松找到哪个.gitignore(以及哪个规则)负责忽略您的.obj 文件:

git check-ignore -v -- dragon.obj

OP 报告:

"D:\\Documents\\gitignore_global.txt":5:*.obj –

类似to this comment:

这是SourceTree(一个可视化git repo的工具)的安装,它在文档文件夹下不合逻辑地创建了gitignore_global.txt,其中包含大量排除项。

git config -l 应该显示类似于:

[core] 
   excludesfile = C:\\Users\\username\\Documents\\gitignore_global.txt

【讨论】:

  • 天哪,你是对的,"D:\\Documents\\gitignore_global.txt":5:*.obj
  • @elect 看起来像源树安装:stackoverflow.com/questions/9436405/…。我已经编辑了答案。
  • 无论如何提交现在看到它们,我正在上传它们,谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-15
  • 2015-11-30
  • 2012-07-12
  • 2016-04-09
  • 1970-01-01
相关资源
最近更新 更多