Search code examples
gitgitolite

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


When pushing on my server the post-receive hook runs a simple git clone command.

The command returns the following warning and I don't know what it means or how to resolve it. Googling the error gave only results concerning gitattributes and I haven't configured any attributes. My .gitignore file also has no exclamation marks or negative values inside.

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

Solution

  • Do not mix gitignore and gitattributes.

    One of your gitattributes file use a negative pattern that is not allowed.
    Search for one of those files:

    • .gitattributes inside any folder of your repository
    • $GIT_DIR/info/attributes
    • $(git config --get core.attributesFile)
    • $XDG_CONFIG_HOME/git/attributes
    • $HOME/.config/git/attributes
    • $(prefix)/etc/gitattributes

    One of them use a negative pattern. You just need to fix it (by adapting your gitattributes model or escaping the exclamation point)