Skip to content

Instantly share code, notes, and snippets.

@SamuelMarks
Created December 20, 2019 12:42
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 SamuelMarks/f1c4d5d21a902fc396e7e834a467f07e to your computer and use it in GitHub Desktop.
Save SamuelMarks/f1c4d5d21a902fc396e7e834a467f07e to your computer and use it in GitHub Desktop.
Transfer all repos on GitHub.com (api.github.com) between organisations
#!/usr/bin/env bash
organisations="$(hub api '/user/orgs' | jq -r '.[] | .login')";
repos="$(for org in $organisations; do hub api '/orgs/'"$org"'/repos' | jq -r '.[] | .name'; done)"
for org in $organisations; do
for repo in $repos; do
( hub api '/repos/'"$org"'/'"$repo"'/transfer' -F 'new_owner'='offscale' | jq . ) &
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment