Skip to content

Instantly share code, notes, and snippets.

@jrafanie
Forked from mausch/gitremoteaddall.sh
Created April 27, 2012 16:03
Show Gist options
  • Save jrafanie/2510420 to your computer and use it in GitHub Desktop.
Save jrafanie/2510420 to your computer and use it in GitHub Desktop.
Adds all github forks in the network for a particular repository - sed -r option (linux) is -E on mac
mainrepo="mausch/solrnet"
urls=$(curl -s "https://github.com/api/v2/json/repos/show/$mainrepo/network" | python -mjson.tool | grep "url" | grep -vi "$mainrepo" | sed -Ee 's/.*(https.*)".*/\1/')
for url in $urls; do
remote=$(echo $url | cut -d/ -f4)
giturl=$(echo $url | sed -Ee 's/https/git/;s/$/.git/')
git remote add $remote $giturl
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment