github api v3从除master以外的特定分支获取文件的内容 [英] github api v3 to fetch contents of a file from a particular branch other than master

查看:231
本文介绍了github api v3从除master以外的特定分支获取文件的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用github v3内容api从特定分支获取文件内容
http://developer.github.com/v3/repos/contents/
i尝试了这些选项
https://api.github.com/repos/ 'org_name'/'repo_name'/ contents /'file_path'
https://api.github.com/repos/ 'org_name'/'repo_name'/ contents /'file_path'/?ref = branch_name
或相当多的选项,但它只从master分支获取文件内容。



但是我需要从主分支以外的分支中获取内容。
我知道我错过了一些非常基本的东西,但不知道是什么。
在此先感谢

解决方案

这很奇怪,因为它似乎适用于我。以下是从Google的GitHub组织的跟踪框架回购库中获取gh-pages分支中的index.html文件的URL: https://api.github.com/repos/google/tracing-framework/contents/index .html?ref = gh-pages



主文件中不存在index.html文件。



你能给出你正在尝试的确切URL吗?


How to use github v3 contents api to fetch a file's contents from a particular branch http://developer.github.com/v3/repos/contents/ i tried these options https://api.github.com/repos/'org_name'/'repo_name'/contents/'file_path' https://api.github.com/repos/'org_name'/'repo_name'/contents/'file_path'/?ref=branch_name or quite a few options , but it fetches the file contents from the masters branch only.

but i need to fetch the contents from a branch other than master. I know i am missing something very basic , but not a figure out what. thanks in advance

解决方案

That's strange because it seems to work for me. Here is the URL for fetching the index.html file in the gh-pages branch from the tracing-framework repo from Google's GitHub organization:

https://api.github.com/repos/google/tracing-framework/contents/index.html?ref=gh-pages

The index.html file doesn't exist in master.

Can you give the exact URL you are trying?

这篇关于github api v3从除master以外的特定分支获取文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆