Search code examples
githubgithub-linguist

.gitattributes file isn't excluding files from the language statistics


I am currently learning OpenGL and am uploading my program to GitHub. However, because the dependencies are included in the language statistics the statistics are massively inflated.

I have attempted to write a .gitattributes file to sort this however I can't get it working. I have gone through github-linguistics documentation and several questions on here and have found nothing that works. I have used the git check-attr command and there are no attributes assigned to the files.

The code below is what is in the .gitattributes file, and I will also include a link to the repository itself in case that helps.

OpenGl[[:space]]Tutorial[[:space]]Project/Dependencies/** linguist-vendored
OpenGl[[:space]]Tutorial[[:space]]Project/glad.c linguist-vendored

https://github.com/HDonovan96/Programming

What I expect to be happening is that the 'glad.c' file and every file in 'Dependencies' to be excluded from the language statistics, however they are still all included.


Solution

  • You're missing trailing : characters in your [[:space:]]. Try this instead:

    OpenGl[[:space:]]Tutorial[[:space:]]Project/Dependencies/** linguist-vendored
    OpenGl[[:space:]]Tutorial[[:space:]]Project/glad.c linguist-vendored