9

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

在此处输入图像描述

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


解决了:

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

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

2 回答 2

13

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

# Example of a `.gitattributes` file which reclassifies `.rb` files as Java:
*.rb linguist-language=Java
于 2019-03-01T14:14:22.237 回答
1

在您的存储库中创建一个新文件并将其命名为.gitattributes. 之后,请确保您设置linguist-detectabletrue这样:

*.css linguist-detectable=false
*.java linguist-detectable=false
*.python linguist-detectable=true 
*.js linguist-detectable=false
*.html linguist-detectable=false  
*.xml linguist-detectable=false 
于 2020-06-04T23:56:19.980 回答