这是我的第一个github仓库,我使用该仓库来熟悉github的工作流,尝试github的一些功能。在学习过程中会记录一些github的使用技巧。
如果你想要参与贡献必要准遵守我们的行为准则;如果你发现有人违反该准则,可以通过我的邮箱联系我。
Our goal is for this project to reflect community best practices, so we'd love your input! Got a question or an idea? Check out our contributing guidelines for ways to offer feedback and contribute.
This software is licensed under the MIT License. View the license.
2019年7月22日11:07:27 添加
https://yansheng836.github.io/hello-world/
自动统计语言,将最多的语言作为该项目的语言(即个人仓库列表中显示的语言),这是github的一个特点,gitee就没有。
该仓库的语言识别(2019年9月6日):
项目主页:
仓库列表显示:
Bootstrap仓库的语言识别:
如果你的github仓库的语言统计(显示/识别)有问题,例如你项目使用的主要的语言是HTML,但是因为你使用了Bootstrap框架(非CDN方式),默认情况下,github可能会识别到你的仓库中的JavaScript代码比较多,因此会将你的项目识别成一种不是你想要的语言(JavaScript),那有没有办法进行”自定义“呢?github会告诉你:有!你可以通过.gitattributes
文件强制github将项目语言识别成你想要的语言,具体介绍可参考:github/linguist项目,下面只是简单介绍。
需要注意的问题:
.gitattributes
文件对应的属性时,项目会显示为HTML,但是你点开语言前面的小点,会进到项目语言统计列表中,这里仍然会显示项目使用的各种文件,比如Bootstrap框架的CSS/JS文件。.gitattributes
文件有这个功能,但是该文件的作用却远不止于此,详见:git 官方 gitattributes文档(English).主要有5种类型的属性可以设置,github会读取你设置的属性值,然后有选择的识别某语言的显示。需要注意的是,关于语言的识别github是有一套默认的机制的,例如它会将一些有特征的文档文件(详见:documentation.yml)识别为文档,不统计这种语言。更多默认设置可参考:https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml。
因此如果你需要自定义,github的建议是Override
,即重写(或者说是覆盖)默认的设置。
注:下表非官方文档,仅供参考。
.gitattributes属性分类 | 分类 | 简单说明 | 举例 | |
---|---|---|---|---|
linguist-language |
语言转化 | 将一种语言识别为另一种语言 | *.rb linguist-language=Java |
languages.yml |
linguist-vendored |
供应(商)代码 | 标记供应商文件,把使用的库文件标记为供应商代码(即不是自己编写的),如jQuery库文件 | jquery.js linguist-vendored |
vendor.yml |
linguist-generated |
生成的代码 | 标记一些生成的文件,如压缩的js默认被忽略 | Api.elm linguist-generated=true | generated.rb |
linguist-documentation |
文档 | 标记一些文档 | project-docs/* linguist-documentation |
documentation.yml |
linguist-detectable |
可检测的 | 标记某文件是否检测为语言,默认(各种常见语言)都可检测,为false时,不进行语言检测 | export_bom.py linguist-detectable=false | languages.yml |
注意:
.gitattributes
文件有错误,git add 或者git commit 时会给出提示,github上面也会有相应提示。jquery.js linguist-vendored=true
这种属性值为布尔值的,好像只有使用 jquery.js linguist-vendored
这种形式才有用。举例:https://github.com/github/linguist/issues/4590
Create a file named
.gitattributes
in the root of your projectAdd the following lines to the
.gitattributes
file:/BibliotecaGames.Entities/* linguist-vendored=true /BibliotecaGames.BLL/* linguist-vendored=true
- Modify a file in your project to force GitHub to detect the new
.gitattributes
file
github技巧推荐:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。