This shell script transfers all repositories of a specified user to a specified organization on GitHub. The script uses GitHub CLI to list all repositories of the user and then uses GitHub API to transfer each repository to the organization.
- Bash shell (Unix environment)
- GitHub CLI installed and authenticated
- jq command-line JSON processor
- curl command-line tool for making HTTP requests
- set variables in github_repo_transfer.sh
user_name=""
org_name=""
# https://github.com/settings/tokens -> Generate new token
token=""
- run script
$ sh github_repo_transfer.sh
This script transfers the ownership of your repositories to another organization. You will lose admin rights to these repositories unless you are an owner of the organization. Please use this script responsibly and double-check the organization name before running the script.