Skip to content

Instantly share code, notes, and snippets.

@eana
Last active February 14, 2021 12:26
Show Gist options
  • Save eana/b8792d0f6e484cfbfe73b94974514f58 to your computer and use it in GitHub Desktop.
Save eana/b8792d0f6e484cfbfe73b94974514f58 to your computer and use it in GitHub Desktop.
Clone all repositories, including the private ones.
#!/usr/bin/bash
GITHUB_TOKEN=$(grep token ~/.gitconfig | awk '{print $3}')
GITHUB_USER="eana"
REPOSITORIES=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/user/repos?per_page=100 | grep ssh_url | grep "${GITHUB_USER}" | cut -d ':' -f 2-3 | tr -d '",')
for repository in ${REPOSITORIES}; do
git clone "${repository}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment