如何使用GitHub api获取用户存储库数量?

问题描述 投票:0回答:2

我正在尝试获取用户的存储库数量,而不使用 api.github.com/users/userName/repos 获取所有存储库。有什么解决办法可以做到这一点吗?

谢谢

github github-pages github-api
2个回答
1
投票

https://api.github.com/users/userName
处的数据包括密钥
public_repos
,表示给定用户的公共存储库数量


0
投票

是的,你可以这样做

注意:在这个例子中我使用的是javascript

fetch("https://api.github.com/users/YOUR_USERNAME")
  .then((response) => response.json())
  .then((data) => console.log(data.public_repos));
© www.soinside.com 2019 - 2024. All rights reserved.