gpt4 book ai didi

git - 在 .gitattributes 文件中添加多种语言

转载 作者:太空狗 更新时间:2023-10-29 14:03:26 26 4
gpt4 key购买 nike

我拥有一个 Github repository它有一组不同语言的脚本/程序来执行任务。问题是默认情况下,我的存储库被标记为单一语言。我用谷歌搜索并尝试使用 .gitattributes 文件修复它。

* linguist-vendored
*.py linguist-vendored=false

这段代码帮助我将 Python 标记为默认语言,但我仍然希望我的 repo 被标记为更多语言。有没有办法实现这一目标?或者只能有一种语言标有存储库?谢谢。

最佳答案

GitHub 的语言检测有 its own rather lengthy README.md file您还将在下面看到 the repository itself 的内容.正如它所指出的,它可以检测多种不同的语言并显示它们:

Image desc

但是:

Linguist ... excludes all ... vendored code

并通过写作:

* linguist-vendored

您已指示它忽略所有文件。您的后续指令:

*.py linguist-vendored=false

专门为 *.py 文件覆盖此指令,允许对它们进行分类。

奇怪的是你根本没有添加 .gitattributes 。只有在必须 stash 文件或覆盖自动检测时才需要这样做。您所做的是 stash 所有非 *.py 文件,因此您正在对 确实* 匹配的文件应用自动检测(而不是显式语言覆盖) .py 模式。

您还应该特别注意他们的评论:

When you push changes to a repository on GitHub.com, a low priority background job is enqueued to analyze your repository as explained above. The results of this analysis are cached for the lifetime of your repository and are only updated when the repository is updated. As this analysis is performed by a low priority background job, it can take a while, particularly during busy periods, for your language statistics bar to reflect your changes.

(强调我的)

关于git - 在 .gitattributes 文件中添加多种语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50428071/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com