Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

23 Apr 2014

Clone all your repositories on another machine

Recently I was configuring a new machine (God, i love Chocolatey) and I wanted to take all the repositories I have under c:/src and clone them on my new machine. Here is how i did that:

# write all remote fetch locations into repositories.txt  
find /c/src -type d -mindepth 1 -maxdepth 1 -exec git -work-tree={} -git-dir={}/.git remote -v \; | grep fetch | awk '{print $2}' > repositories.txt

# clone each repository  
cat repositories.txt | xargs -l1 git clone

Or as a gist: https://gist.github.com/timvw/11208834.