Created
August 30, 2016 17:34
-
-
Save kalkin/64f17022de54e9eff9d45f5ae9ca8f64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Bahtiar `kalkin-` Gadimov <bahtiar@gadimov.de> | |
# | |
# Shell script to list all the repositories of a user or organization. | |
# | |
# This script depends only on curl(1). It will list only the first 10,000 repos. | |
# Keep in mind that Github limits API requests for non authenticated users. | |
# License: Public Domain | |
name="$1" | |
repos=$(curl -si https://api.github.com/orgs/"$name"/repos\?per_page\=10000|grep clone_url) | |
[ ! "$repos" ] && repos=$(curl -si https://api.github.com/users/"$name"/repos\?per_page\=10000|grep clone_url) | |
[ "$repos" ] && echo "$repos"|cut -d":" -f2-|tr -d '," ' && exit 0 | |
echo "No user or org $name found" >&2 | |
exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment