Skip to content

Instantly share code, notes, and snippets.

@kalkin
Created August 30, 2016 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalkin/64f17022de54e9eff9d45f5ae9ca8f64 to your computer and use it in GitHub Desktop.
Save kalkin/64f17022de54e9eff9d45f5ae9ca8f64 to your computer and use it in GitHub Desktop.
#!/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