【发布时间】:2017-04-04 16:19:00
【问题描述】:
我阅读了 a blog post 描述如何访问 GitHub 中的原始内容:
这并不完全明显(至少对我来说不是),但因为 Github wikis 实际上是由适当的 Git 存储库支持的,我想它 应该可以通过使用访问页面的原始降价 Github 的 https://raw.github.com/ 样式 URL。
经过一些小的试验/错误,结果证明是非常可预测的(如 github中有很多东西):
https://raw.github.com/wiki/[user]/[project]/[page].md
我有一个回购 mbigras/hello-world 和一个维基页面 mbigras/hello-world/wiki/foobar。所以根据上面的模式,以下应该可以工作:
https://raw.github.com/wiki/mbigras/hello-world/foobar.md
GitHub 好像改变了路由,如下图:
$ curl https://raw.github.com/wiki/mbigras/hello-world/foobar.md
$ curl -Is https://raw.github.com/wiki/mbigras/hello-world/foobar.md 2>&1 | head -n 2
HTTP/1.1 301 Moved Permanently
Location: https://raw.githubusercontent.com/wiki/mbigras/hello-world/foobar.md
$ curl -L https://raw.github.com/wiki/mbigras/hello-world/foobar.md
{
"foo": "bar",
"cat": "dog",
"red": "hat"
}
所以新模式似乎是:
https://raw.githubusercontent.com/wiki/[user]/[project]/[page].md
- GitHub 是否发布了有关如何访问 wiki 页面的原始降价源的文档?
【问题讨论】:
-
这似乎不再起作用 - 2018 年 2 月
-
已修复 -- 见下文