How to change the language of a repository on GitHub?

You can also override certain files

$ cat .gitattributes
*.rb linguist-language=Java

Source


It is purely deduced from the code content.

As Pedro mentions:

Please note that we count the total bytes of each language's file (we check the extension) to decide the percentages.
This means that if you see your project reported a JavaScript, but you swear you use Ruby, you probably have a JS lib somewhere that is bigger than your Ruby code

As detailed in "Github changes repository to wrong language", you can add a .gitattributes file in which you can:

  • ignore part of your project (not considered for language detection)

    static/* linguist-vendored
    
  • consider part of your project as documentation:

    docs/* linguist-documentation
    
  • indicate some files with specific extension (for instance *.rb) should be considered a specific language:

    *.rb linguist-language=Java
    

You can also make some of the files vendor-ed. Just create a .gitattributes file in the main directory. If you want to exclude CSS from the language statistics write into the file something like this. client/stylesheets/* linguist-vendored

This will hide all files in the client/stylesheets/ from the language statistics. In my case these are the .css files.

This solves your problem partly, because hides the most used language and choose the second one to be prime.

Tags:

Github