Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save benjaminblack/b04f1154a629ab824d4a71f69f32d7c2 to your computer and use it in GitHub Desktop.
Save benjaminblack/b04f1154a629ab824d4a71f69f32d7c2 to your computer and use it in GitHub Desktop.
Get a list of all of your GitHub repositories

Replace <username> with your GitHub username and be prepared to enter your GitHub password on the command line.

If you have more than 100 repositories, you'll need to run this command several times, editing the page=? parameter each time.

Replace ssh_url in the jq query with git_url for git:// scheme, and with clone_url for https:// scheme.

LISTFILE=repos.txt
curl -u "<username>" "https://api.github.com/user/repos?page=1&per_page=100" | jq '.[].ssh_url' | while read repo
do
    repo="${repo%\"}"
    repo="${repo#\"}"
    echo "$repo" >> $LISTFILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment