John Datserakis

John Datserakis

How To Adjust Your Repository's Assigned Language On GitHub

Do you have a repo that GitHub just can't seem to label correctly? Let's see what we can do to fix it.

We've all been there. You're wrapping up a project and decide to take some time to spruce up your repo's page.

Then you notice your JavaScript-heavy program seems to be labeled as a CSS or HTML app.

Even worse - that's the label that's shown in the pinned repositories section of your profile.

It turns out that GitHub's language analyzer can incorrectly label your project because it could get jammed up with vendor files or something similar.

In doing some research into the issue when a repo of mine displayed symptoms, I found that it seems to be happening more often than you'd think. No biggie though, use the following to get it sorted.

First, create a .gitattributes file in the root directory of your project.

Open the file and enter a version of the following based on your need:

1# Use the linguist-vendored tag for excluding vendored files. 2src/assets/css/* linguist-vendored

Now just push your code to master and wait for the changes to update. Some users report that there can be some time before you see the label change.

To get more info on dealing with the GitHub language detection going haywire - visit this link.