http - 有关如何访问 GitHub wiki 页面的原始 Markdown 的文档在哪里?

标签 http curl github

我读了a blog post描述如何访问 GitHub 中的原始内容:

This is not entirely obvious (at least it wasn’t for me), but since Github wikis are actually backed by a proper Git repo, I figured it should be possible to access the raw markdown for a page by using Github’s https://raw.github.com/ style URLs.

After some minor trial/error, it turns out to be very predictable (as many things in 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 页面的原始 markdown 源的文档?

最佳答案

GitHub 是否发布有关如何访问 wiki 页面的原始 markdown 源的文档?

是的,GitHub 在 blog 中记录了如何导出 wiki , 2010 年 Wiki 发布时。

Each wiki is a Git repository, so you're able to push and pull them like anything else. Each wiki respects the same permissions as the source repository. Just add ".wiki" to any repository name in the URL, and you're ready to go.

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

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

关于http - 有关如何访问 GitHub wiki 页面的原始 Markdown 的文档在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43212618/

相关文章:

azure - 有没有办法在 Azure 数据工厂中使用 cURL 命令?

git - 如何更改已提交 GitHub 上的身份

git - 在 git 中使用多个 Remote

c# - 使用 Html Agility Pack 抓取网站。 GET 的响应不符合预期

C++ POST 表单数据

node.js - 使用curl在node.js上进行基本身份验证

ruby-on-rails - Docker Rails 应用程序无法提供服务 - curl : (56) Recv failure: Connection reset by peer

git - 如何将多个项目添加到 Bitbucket 中的单个存储库中?

java - 使用 Android M 上网

macos - 在系统级别的 Mac OS X Lion 上修改传出的 HTTP header