Git clone all organizational repos

James Tubberville | March 13, 2019 | Tweet This Post

This is a short form post resulting from conversations over single line cloning and/or pulling of all organizational repos.

In short, I once needed a quick and easy bash method for pulling all repos under an organizational tree. The following three one-liners were used (and have been used many times since). I regularly use the last to pull all repos before beginning any additions or mods to ThreatExpress.

As usual, you can find the raw script and get the latest version of tools on our GitHub repository:

Clone all public repos

for line in $(curl | grep -o "[^ ,\"]\+");do echo git clone $line;done

Clone private repos as well

for line in $(curl<EnterTokenHere> | grep -o "[^ ,\"]\+");do git clone $line;done
Generate your personal access token in your github profile > Developer Settings > Personal Access Tokens

Pull all repos within a hierarchical folder structure

find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull \;
I store all repos within organizational folders in a designated location. Change depth to accommodate your structure

Originally published at