2017-04-04 77 views
2

我读a blog post描述如何访问GitHub的内部原始内容:如何访问GitHub wiki页面的原始降价文档在哪里?

这并不完全是显而易见的(至少这不是对我来说),但维基因为 Github上通过适当的Git支持实际回报,我想它 应该可以通过使用 Github的https://raw.github.com/样式URL访问页面的原始降价。

一些小的试验/错误后,它原来是很容易预测(如在 GitHub的很多东西):

https://raw.github.com/wiki/[user]/[project]/[page].md 

我有一个回购mbigras/hello-worldmbigras/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页面的原始降价源的文档吗?
+0

这似乎并不工作了 - 2018年2月 – Federico

回答

-3

您应该使用GitHub的API

curl -sS -u <github_user>:<password/token> -H 'Accept: application/vnd.github.v3.raw' -o <output_file> https://<your-github-doman>/api/v3/repos/<org/user>/<repo_name>/contents/<file_name>

2

是否GitHub上发布有关如何访问原始降价源维基页面文件?

是,GitHub的文件如何导出wiki中,blog,当维基发布于2010年

每个Wiki是一个Git仓库,让你能够像别的推拉他们。每个wiki都遵守与源存储库相同的权限。只需将“.wiki”添加到URL中的任何存储库名称,即可开始使用。

在你mbigras/hello-world情况下,命令将是:

git clone https://github.com/mbigras/hello-world.wiki.git