在GitHub上更改存储库语言

在GitHub上更改存储库语言

问题描述:

我注意到Github选择JavaScript作为我的Django应用程序的语言:

I've noticed that Github picked JavaScript as the language for my Django app:

是否可以将其更改为Python?还是我需要建立一个新的存储库?

Is it possible to change it to Python? Or do I need to make a new repository?

已解决:

正如@Geno Chen所说,要更改存储库语言,我们必须添加包含以下代码的.gitattributes文件:

As @Geno Chen said, to change the repository language we have to add the file .gitattributes containing this code:

# to change language of repo from Javascript to Python
    *.js linguist-language=Python

语言检测器统计程序在您的项目中,并以比率显示结果.如果您的存储库检测到错误的语言,则可以按照教程进行操作,大多数情况下,您只需要使用覆盖结果存储库根目录中的.gitattributes包含类似于本教程中的示例的内容,以手动提高特定编程语言的比例:

The language detector stats the programs in your projects and shows the result with the ratio. If your repository have detected a wrong language, you can follow the tutorial, most of the time you just need to override the result with a .gitattributes in the repository root containing something like the sample from tutorial, to manually pull up the ratio of specific programming language:

# Example of a `.gitattributes` file which reclassifies `.rb` files as Java:
*.rb linguist-language=Java