Skip to content

Instantly share code, notes, and snippets.

@coderbyheart
Last active October 20, 2018 06:44
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 coderbyheart/5c86b87405e38ec01149fc8bd34cc52c to your computer and use it in GitHub Desktop.
Save coderbyheart/5c86b87405e38ec01149fc8bd34cc52c to your computer and use it in GitHub Desktop.
Batch clone repo containing certain filename
GITHUB_USERNAME=coderbyheart
ACCESS_TOKEN=`cat ~/.netrc | grep "github.com login $GITHUB_USERNAME" | awk '{ print $6; }'`
ORGANIZATION=nrfcloud
FILENAME=buildspec.yml
# Clone them all
curl -u $GITHUB_USERNAME:$ACCESS_TOKEN -s https://api.github.com/search/code\?q=org%3A${ORGANIZATION}+filename%3A$FILENAME | jq ".items[].repository.full_name" -a | xargs -I{} git clone https://github.com/{}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment