Git - 是什么导致“警告:在 git 属性中忽略否定模式”

Git - what is causing “warning: Negative patterns are ignored in git attributes”

在我的服务器上推送时,post-receive 挂钩运行一个简单的 git clone 命令。

命令returns出现以下警告,我不知道这是什么意思,也不知道如何解决。谷歌搜索错误只给出了有关 gitattributes 的结果,我没有配置任何属性。我的 .gitignore 文件里面也没有感叹号或负值。

remote: Cloning into '/var/www/html/gitrep'...        
remote: warning: Negative patterns are ignored in git attributes
remote: Use '\!' for literal leading exclamation.

不要混用gitignore and gitattributes.

您的一个 gitattributes 文件使用了不允许的否定模式。
搜索其中一个文件:

  • .gitattributes 在存储库的任何文件夹中
  • $GIT_DIR/info/attributes
  • $(git config --get core.attributesFile)
  • $XDG_CONFIG_HOME/git/attributes
  • $HOME/.config/git/attributes
  • $(prefix)/etc/gitattributes

其中一个使用负片图案。你只需要修复它(通过调整你的 gitattributes 模型或转义感叹号)