c# - 如何从 Github 存储库获取所有文件路径

标签 c# git github

我正在使用 GitHub Developer API v2。当前需要从存储库中检索所有文件路径。有没有人有这方面的经验?

最佳答案

作为起点,您可以检查 ls-tree 的输出是什么样的。
但是:

  • 对该输出进行一些解析,以便您获得所需的准确结果。
  • 它似乎不是递归的!

进入树 GitHub Api V2 is described here .
只有 GitHub Api V3提到一个 ?recursive=1 选项。

tree/show/:user/:repo/:tree_sha

您可以在 this article 中查看示例:

To get a listing of the root tree for the facebox project from our commit listing, we can call this:

$ curl http://github.com/api/v2/yaml/tree/show/defunkt/facebox/f7a5de2e224ec94182a3c2c081f4e7f4df70da4
---   
tree:   
- name: .gitignore  
  sha: e43b0f988953ae3a84b00331d0ccf5f7d51cb3cf  
  mode: "100644"  
  type: blob  
- name: README.txt  
  sha: d4fc2d5e810d9b4bc1ce67702603080e3086a4ed  
  mode: "100644"  
  type: blob  
- name: b.png  
  sha: f184e6269b343014f58694093b55558dd5dde193  
  mode: "100644"  
  type: blob  
- name: bl.png  
  sha: f6271859d51654b6fb2719df5fe192c8398ecefc  
  mode: "100644"  
  type: blob

关于c# - 如何从 Github 存储库获取所有文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8034945/

相关文章:

github - SSH 访问 GitHub 存储库

c# - 公约问题: When do you use a Getter/Setter function rather than using a Property

eclipse - 无法使用 git 提交我的项目

merge 后git恢复已删除的文件

git - Teamcity REST API 在分支上获得最新的成功构建

Github/在 HEAD 中比较 : How to diff two different files (different file names,)?

c# - 如何根据参数转换对象类型?

c# - 使用 XPathNavigator 计算 Mod 值

c# - 属性上的 SetValue 不更新对象

git - 使用 merge 的提交重新设置Git