在 GitHub 上更改存储库语言

Changing repository language on GitHub

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

可以改成Python吗?或者我需要创建一个新的存储库吗?


已解决:

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

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

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 存储库根目录中带有 .gitattributes 的结果包含类似教程示例的内容,以手动提取特定编程语言的比例:

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

在您的存储库中创建一个新文件并将其命名为 .gitattributes。之后确保将 linguist-detectable 设置为 true,如下所示:

*.css linguist-detectable=false
*.java linguist-detectable=false
*.python linguist-detectable=true 
*.js linguist-detectable=false
*.html linguist-detectable=false  
*.xml linguist-detectable=false