Language statistics on Github-linguist now incorporate files labeled with linguist-vendored attribute. The would be Incorporation of linguist-vendored attribute labeled files in Github-linguist’s language statistics

Despite changing the file to only “”, it failed to exclude the files within. To solve this, I created a file named “” in the main repository directory and added the following to it: “Ignore all files and only consider .js files”. This solution seemed to be the easiest.


My github repository is mostly composed of C++, but it also contains vendor-generated C code, which are drivers for a microcontroller. These C code files are interfering with the language statistics. To address this, I followed the instructions on this page and added a new file in my repository called


. The purpose of this file is to mark all driver files as


so that they will not be included in the statistics. Despite setting the


attribute in

git check-attr

, the


command line tool is still ignoring it. I am unsure of what I am doing wrong.

$ cat .gitattributes
STM32[[:space:]]Code/*/** linguist-vendored
STM32[[:space:]]Code/*/Core/Src/** -linguist-vendored
STM32[[:space:]]Code/*/Core/Inc/** -linguist-vendored
$ git add .gitattributes
$ git commit --amend --no-edit
[master 017861e] fix github language metrics
 Date: Sat Sep 25 16:09:00 2021 -0700
 1 file changed, 3 insertions(+)
 create mode 100644 .gitattributes
$ git check-attr -a "STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c"
STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c: linguist-vendored: set
$ github-linguist --breakdown
94.75%  C
2.92%   C++
2.09%   Makefile
0.23%   Assembly
0.01%   Shell
STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c

In addition, I attempted to modify the file labeled


to something else.

STM32[[:space:]]Code/** linguist-vendored

Even the files inside are not overlooked.


It is possible that you are utilizing outdated versions of Linguist and/or rugged, which are responsible for checking the gitattributes. These versions may have been included in your operating system. I cannot replicate the issue you are experiencing using the most recent version that GitHub is currently employing.

$ gem install github-linguist
Fetching github-linguist-7.16.1.gem
Building native extensions. This could take a while...
Successfully installed github-linguist-7.16.1
1 gem installed
$ git init foo
Initialized empty Git repository in /Users/lildude/Downloads/trash/foo/.git/
$ mkdir -p "foo/STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/"
$ echo "foo" > "foo/STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c"
$ cd foo
$ git add .
$ git commit -m 'Initial commit'
$ github-linguist . --breakdown
100.00% 4          C
STM32 Code/BLDC/Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c
$ echo "STM32[[:space:]]Code/*/** linguist-vendored" > .gitattributes
$ git add .gitattributes
$ git commit -m 'overwrite'
[main 15e0a4e] overwrite
 1 file changed, 1 insertion(+)
 create mode 100644 .gitattributes
$ github-linguist . --breakdown

Frequently Asked Questions

Posted in Git