Skip to content

Instantly share code, notes, and snippets.

@maidis
Last active March 30, 2020 21:19
Show Gist options
  • Save maidis/04e76687efe333a2fb09c684c4d02718 to your computer and use it in GitHub Desktop.
Save maidis/04e76687efe333a2fb09c684c4d02718 to your computer and use it in GitHub Desktop.
git-all.sh
#!/bin/bash
# Script that downloads all projects written in a specified language from a GitHub organization
# https://gist.github.com/vke-code/fda27b3ae617e733f3d28e939caee22f
# https://kai-taylor.com/download-github-repos-for-user/
# https://stackoverflow.com/questions/58826803/how-to-filter-language-for-cloning-multiple-github-repositories-with-curl
if [ $# -ne 2 ]
then
echo "Usage: $0 <org_name> <lang_name> "
exit;
fi
ORG=$1 # StarlangSoftware
LANG=$2 # C++
for repo in `curl -s https://api.github.com/orgs/$ORG/repos?per_page=200 | jq '.[]|select(.language | contains("'${LANG}'")).git_url' | cut -c2- | rev | cut -c2- | rev`; do
git clone $repo;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment