0
我试图使用GitHub API获取指定存储库的默认分支(owner/repo
)。获取GitHub存储库的存储库默认分支
我没有找到任何有关文件。为了让所有的分支我使用:
curl https://api.github.com/repos/owner/owner/branches
此输出以下JSON:
[
{
"name": "docs",
"commit": {
"sha": "a3...",
"url": "https://api.github.com/repos/owner/repo/commits/a3..."
}
},
{
"name": "master",
"commit": {
"sha": "8c...",
"url": "https://api.github.com/repos/owner/repo/commits/8c..."
}
}
]
这已经是有用的,因为在我的情况下,默认分支或者是master
(如果存在)或gh-pages
。但我仍然想知道获取GitHub存储库默认分支的正确方法。