GitHub:技巧集合

列出全部文件

仓库 URL + find/分支名称,例如:https://github.com/onestark/learn-css/find/mastercss

Raw 文件

在浏览器中以 text/plain 查看原始文件。git

例如,GitHub 文件原连接:github

https://github.com/onestark/alfred-workflows/blob/master/README.md

可经过如下几种 URL 查看 raw 文件:浏览器

https://raw.githubusercontent.com/onestark/alfred-workflows/master/README.md
https://github.com/onestark/alfred-workflows/raw/master/README.md
https://github.com/onestark/alfred-workflows/blob/master/README.md?raw=true

文件下载

不支持 Raw 查看的文件,在浏览器中输入或点击上述查看 raw 文件的 URL 时,会对文件进行下载。所以能够经过这个特性,在 GitHub 上直接提供文件的下载功能。缓存

支持 Raw 查看的文件,可在浏览器打开 raw 页面,直接 另存为... 保存便可代理

展现 Demo

GitHub 仓库开通 GitHub Pages 后,其中的 HTML 文件就能够被浏览器正确渲染了,所以这个功能不只能够做为项目的展现页,也能够展现各类 HTML demo 文件。code

RawGit

When you request certain types of files (like JavaScript, CSS, or HTML) from raw.githubusercontent.com or gist.githubusercontent.com, GitHub serves them with a Content-Type header set to text/plain. As a result, most modern browsers won't actually interpret these files as JavaScript, CSS, or HTML and will instead just display them as text.ip

RawGit 做为一个缓存代理,提供的功能是缓存 GitHub 中 raw 文件并添加上正确的 Content-Type header,从而使文件能被浏览器正确渲染。get

RawGit 对未开通 GitHub Pages 的项目中的任意 HTML/CSS/JS 文件以及 Gist 代码的渲染展现提供了方便。workflow

使用方法:https://rawgit.com/https://raw.githack.com/

添加 LICENSE

  • 建立项目时,有添加 LICENSE 选项;

  • 建立项目后,添加新文件,输入文件名 LICENSE 时右侧会出现 LICENSE 模板选项。

相关文章
相关标签/搜索