![Git - 导致“警告:git 属性中忽略负面模式”的原因](https://linux22.com/image/710354/Git%20-%20%E5%AF%BC%E8%87%B4%E2%80%9C%E8%AD%A6%E5%91%8A%EF%BC%9Agit%20%E5%B1%9E%E6%80%A7%E4%B8%AD%E5%BF%BD%E7%95%A5%E8%B4%9F%E9%9D%A2%E6%A8%A1%E5%BC%8F%E2%80%9D%E7%9A%84%E5%8E%9F%E5%9B%A0.png)
当在我的服务器上推送时,post-receive
钩子运行一个git clone
命令。
该命令返回以下警告,我不知道这是什么意思,也不知道该如何解决。谷歌搜索错误只给出了有关 gitattributes 的结果,而我尚未配置任何属性。我的 .gitignore 文件中也没有感叹号或负值。
remote: Cloning into '/var/www/html/gitrep'...
remote: warning: Negative patterns are ignored in git attributes
remote: Use '\!' for literal leading exclamation.
答案1
通过搜索.gitattributes
git 存储库中的每个文件解决了问题。
其中一个文件有一行以感叹号开头,但未被注释掉,因此导致了此警告。
答案2
在我的特定情况下,我的顶级目录只有几个选择,所以,因为我知道我想有效地排除 a 下的所有文件,并且我只希望扩展发生在 other_dir 下的所有文件上,然后我将模式更改为:
other_dir/**/*.awk ident
*.c ident
我发现这个链接可能会对你有帮助 -
http://www.kehe.tech/questions/3254938/how-to-exclude-files-from-git-id-expansion