Github language tag for Repository
Asked Answered
H

4

17

On Github, some projects are tagged as being of one language or another. How do I add one of these tags. (Objective C, PHP etc.)

Hesitate answered 22/7, 2010 at 1:31 Comment(0)
W
17

As far as I know, they aren't really tagged - the languages attached to them are the languages which you use in your project. Github looks through the source and figures out to the best of its ability what languages are in use.

If you go to your respository, then to the Graphs tab, you can see the language breakdown.

Waterish answered 22/7, 2010 at 1:37 Comment(2)
If you see a problem with the languages that are reported, please contact [email protected] -- Also, 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.Price
I couldn't find "Graphs" tab in current GH web version, something changed from 2010 ? or is it hidden under some other tab ?Morlee
C
4

A repository can only be "tagged" with a single language in the search results. That language is the first from language statistics. Language statistics are computed by the open source project Linguist according to the total size of files for each language detected.

You can override language statistics using Linguist overrides. In particular, you can choose to ignore some files from statistics:

directory/to/ignore/* linguist-vendored
*.somextensiontoignore linguist-vendored

or override the detected language:

*.js linguist-language=Java
Coomb answered 13/8, 2017 at 7:43 Comment(2)
This is really unfortunate. We have a project with a subproject embedded in it that is written in a lesser-known language, OCaml. The overall project is tagged, correctly, as a C++ repo, but that means that if you search for OCaml projects, you won't find ours.Turin
GitHub topics are a better way to "tag" a repository with several languages. Alternatively, you could also make a submodule out of the subproject; the subproject's repository should then be appropriately detected as OCaml.Coomb
T
1

You should be able to Publish or Initial Commit with a sample file specific to the language you want it tagged as (such as an empty .cs file or .js file), then add your whole project; however, it seems like a pain.

I did find if you go to 'Add topics' on the far left under the 'Code' section, you can add all the languages you used for anyone that might be looking close enough at your project.

Trilbi answered 5/8, 2017 at 10:22 Comment(0)
H
1

Make .gitattributes file in the root.Then depending on the language type make the below command true.So if your project is Javascript make it true, if your project is java make it true and so on.Push the code and refresh the page.

So now the desired language should get displayed in your git repo.

*.js linguist-detectable=true
*.java linguist-detectable=false
*.html linguist-detectable=false
*.xml linguist-detectable=false
Hendershot answered 4/10, 2019 at 7:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.