git - 从 git azure 获取存储库统计信息/信息

标签 git azure azure-devops

经过研究,我和我的团队没有找到我们想要的东西,所以你们中的一个人可能会帮助我们。

我们正在寻找一种方法来获取 git azure 上所有存储库的统计信息。

我们不需要很多东西,例如,我们所有存储库的列表(大约 150 个)以及每个存储库中的分支数量(或除 master 之外的更好数量的分支),以及这些存储库的作者分支。

这些是基本信息,但我们不知道如何实现这样的目标。

我们已经检查了分析 View 、仪表板……但没有检查过有关存储库和分支的信息。

感谢您的帮助, 苍蝇

最佳答案

您可以通过以下rest api获取组织内的所有仓库:

https://dev.azure.com/{orgName}/_apis/git/repositories?api-version=5.1

如果想要获取指定项目下的所有repos,只需要在请求url中指定projectName即可:

https://dev.azure.com/{orgName}/{proName}/_apis/git/repositories?api-version=5.1

在 postman 中测试:

enter image description here

然后根据获取到的repository id,通过以下api,可以获得分支数量(包括master)、作者、分支名称信息。

https://dev.azure.com/{orgName}/_apis/git/repositories/{repoId}/stats/branches

enter image description here

关于git - 从 git azure 获取存储库统计信息/信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61891445/

相关文章:

azure - 如何在 Azure Devops 部署中不使用基本身份验证

azure-mobile-apps-client - invokeApi 未经授权

azure - 为全局用户使用 Azure

GIT:[拒绝](会破坏现有标签)错误

Git 还原所有匹配模式的行

git - hg 转换中止 : '\n' and '\r' disallowed in filenames:

Git 存储未缓存 : how to put away all unstaged changes?

Git 分支 : There and Back Again

azure - VSO 发布管理错误

azure - 如何删除二头肌模板及其已部署的资源