Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab: remove notebooks from language percentage

At the top of a Gitlab project, there is a bar showing the percentage of each language used inside the project.

In my repository I have dozens of large python files and one little notebook with a few lines of code, but it shows that the project contains mostly notebooks. This is not a bug, it's just related to the fact that plots in particular generates tons of raw lines in the .ipynb files.

I want to avoid this behavior, e.g. by telling Gitlab not to count the lines of this file. I found some solutions for Github, but not for Gitlab.

NB: I don't want to create an extra repository to host one little notebook, even though it would solve this.

like image 386
Quentin BLAMPEY Avatar asked Oct 24 '25 19:10

Quentin BLAMPEY


1 Answers

Add to (or create) your .gitattributes file with the following content:

*.ipynb -linguist-detectable

This will tell linguist to ignore these files when calculating the languages. Similar attributes should also work, like linguist-vendored or linguist-generated.

Also note, per the documentation changes to the .gitattributes file must be committed to the root of the default branch of the project to take effect.

like image 160
sytech Avatar answered Oct 27 '25 11:10

sytech



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!