git - 如何使用 github api 获取 github 存储库中的所有目录和文件?
问题描述
正如标题所说。我想从 github api 获取所有文件和目录。
我找到了这个https://developer.github.com/v3/repos/contents/#get-contents。
GET /repos/:owner/:repo/contents/:path
这个api说Gets the contents of a file or directory in a repository. Specify the file path or directory in :path. If you omit :path, you will receive the contents of all files in the repository.
我调用这个 api,:path
它只返回root
路径中的文件或目录。
响应数据有git_url
字段。它有/repos/:owner/:repo/git/trees/:sha
api 网址。这个api返回文件和目录。
我的问题
- 有没有办法通过只调用一次 GitHub api 来获取我的存储库中的所有文件和目录信息?
- 如果
1.
不可能,我是否必须递归调用 api(上述git_url
字段)来获取所有文件和目录?
提前致谢。
解决方案
推荐阅读
- java - 不显示元素,即使在硒中显示的大小为 1。看我用过的代码
- django - 从 Django 中的通用 CreateView 转发 HTTP?
- tableau-api - Tableau 条形图在工作表和仪表板中看起来不同
- excel - 用于在 excel 中为众多文件设置多用户编辑的 Powershell 脚本?
- python - Teradatasql python 有问题
- java - 用于将文件上传到服务器上的文件夹的 Ajax 调用返回 403 错误
- android - 这里不允许使用属性 android:hardwareAccelerated
- ios - iOS 表格/列表中的粘滞菜单
- python - 使用正则表达式验证用户输入
- mysql - 更新 mysql/mariadb 表时发送电子邮件的清洁、低开销方式?