I know this isn't a huge deal but I like my Github to be linguistically diversified. I wrote a project in Swift and when I commit it says it's in Objective C.
I think it might be because the Parse frameworks are written in Objective C and it detects that, but is there any way to change the display language on the main repository page?
To make it simple, let me share my steps:
Change directory to your project root folder;
Create a file named .gitattributes using whaterver tools of your choice:
Edit the file by follow the Linguist library instructions to tell Github how to do, for example:
Use linguist-vendored can let Github to "skip" detection for this folder and sub-folders:
src/main/resources/static/* linguist-vendored
Use the linguist-documentation attribute to mark or unmark paths as documentation:
project-docs/* linguist-documentation
OR mark an individual file containing documentation
documented_code.rb linguist-documentation=true
This is a bit weird but you can do also -- to tell Github to treat some files with a specific extension (e.g. *.rb) as Java:
*.rb linguist-language=Java
Git add, commit and then push it to Github, the label would be corrected almost immediately.
I found the simplest thing was to create a file called .gitattributes in the root folder of my repository, and give it these contents:
This example tells github/linguist to ignore all files, then just look at .js files. My project https://github.com/aim12340/jQuery-Before-Ready was listed as HTML because the HTML example files were bigger than the JS files. This file fixes it for me and now it's listed as JavaScript
Create a file named .gitattributes to your project root folder. Adding
{file_name} linguist-generated=true
can do the trick. In my case,worked for me.
The solution which was provided by the expert EamonnM who answered this question above worked in my project, but there's two significant things.
The language in the beginning of the second line of his code was the language you want instead of the language you dislike. Remember to distinguish it.
It seems that you could not type any space before the
*
. (For example, I should type*.swift linguist-vendored=false
when I want to change my language into swift.)As mentioned in the GitHub help page
So you need to check with
github/linguist#troubleshooting
in order to fix this situation.Update February 2017 (one year later):
The article "How to Change Repo Language in GitHub" from Monica Powell
The "Using
.gitattributes
" section does illustrate how to mark wrong languages.For instance:
I had a project that was started in Objective-C and changed to Swift completely (new project but in same repository dir). Github kept identifying it as Objective-C no matter what I have put in gitattributes. (all solutions above)
So, if the jig is up, and you're sure all project is one language - you radically put:
Only that fixed the problem :)