Bash脚本列出组织的所有存储库 [英] Bash script to list all repos of an organization

查看:70
本文介绍了Bash脚本列出组织的所有存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个简单的bash脚本,以列出我们组织在github上的所有仓库.似乎不应该那么难,所以我确定我缺少明显的东西.周围有各种各样的例子,例如 1 ,但是它们实际上并没有起作用.我尝试过

I am trying to create as simple bash script to list all the repos in our organization on github. Seems like it shouldn't be that hard, so I am sure I am missing something obvious. Various examples are around, e.g. 1 but they don't really work. I have tried

curl --user "$USER:$PASS" https://api.github.com/orgs/$ORG/repos

其中USER和PASS是有效的用户名和密码,而ORG是 https://github.com/readium .

where USER and PASS are valid usernames and password and ORG is https://github.com/readium.

但这不起作用.我刚收到消息":未找到"

But this doesn't work. I just get "message" : "Not Found"

在这里和其他地方的各种线程之后,我尝试了许多变体,但没有肥皂.有建议吗?

I've tried many variations on this following various threads here and elsewhere but no soap. Suggestions?

推荐答案

curl --user "$USER:$PASS" https://api.github.com/orgs/$ORG/repos |
grep -w 'itemprop="name codeRepository"' |
cut -d/ -f3 | cut -d'"' -f1

例如:

curl -u username:password https://github.com/username?tab=repositories |
grep -w 'itemprop="name codeRepository"' |
cut -d/ -f3 | cut -d'"' -f1

这篇关于Bash脚本列出组织的所有存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆