A Go tool for efficiently managing multiple GitHub repositories from an organization.
- Quickly clone all non-archived repositories from a GitHub organization
- Update existing repositories by fetching remote tracking branches
- Process repositories in parallel for better performance
- SSH key support for authentication
- Safe operations - never modifies local working directories
- Git must be installed and available in your PATH
- A GitHub personal access token with
reposcope - For SSH authentication: properly configured SSH keys for GitHub
You can download the latest pre-built binary for your platform from the Releases page.
We provide builds for:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64, arm64)
After downloading, make the binary executable:
chmod +x github-pokemon-*# Clone this repository
git clone https://github.com/utahcon/github-pokemon.git
cd github-pokemon
# Build the binary
go build -o github-repo-manager
# Optionally move to your path
mv github-repo-manager /usr/local/bin/# Set GitHub token in environment variable
export GITHUB_TOKEN="your-github-personal-access-token"
# Basic usage with required parameters
github-repo-manager --org "organization-name" --path "/path/to/store/repos"
# Check version
github-repo-manager --version
# The tool will automatically check if git is installed and if GITHUB_TOKEN is setFlags:
-h, --help Display help information
-o, --org string GitHub organization to fetch repositories from (required)
-j, --parallel int Number of repositories to process in parallel (default 5)
-p, --path string Local path to clone/update repositories to (required)
-s, --skip-update Skip updating existing repositories
-v, --verbose Enable verbose output
-V, --version Show version information and exit
# Clone/fetch with 10 parallel workers
github-repo-manager --org "my-organization" --path "./repos" --parallel 10
# Skip updating existing repositories
github-repo-manager --org "my-organization" --path "./repos" --skip-update
# Verbose output with status information
github-repo-manager --org "my-organization" --path "./repos" --verbose- The tool queries the GitHub API to list all repositories in the specified organization
- For each non-archived repository:
- If it doesn't exist locally, it clones the repository
- If it exists locally, it only fetches updates to remote tracking branches
- Local working directories are never modified - the tool only updates remote tracking information
- GitHub API: Uses a personal access token via the
GITHUB_TOKENenvironment variable - Git operations: Uses SSH keys configured in your system
-
GitHub Personal Access Token:
- Go to GitHub → Settings → Developer settings → Personal access tokens
- Create a token with
reposcope - Set it in your environment:
export GITHUB_TOKEN="your-token-here"
-
SSH Authentication:
- Generate SSH keys:
ssh-keygen -t ed25519 -C "[email protected]" - Add to SSH agent:
eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519 - Add to GitHub: Copy your public key (
cat ~/.ssh/id_ed25519.pub) and add it in GitHub → Settings → SSH keys
- Generate SSH keys:
- Safe Operations: Never modifies local branches or working directories
- High Performance: Parallel processing significantly speeds up operations
- Organization Backup: Easily create and maintain a local backup of all repositories
- Developer Onboarding: Quickly clone all repositories for new team members
MIT
Here's a common workflow for using this tool:
# Initial setup
export GITHUB_TOKEN="your-github-personal-access-token"
mkdir -p ~/github-repos
# Clone all repositories from your organization
github-repo-manager --org "your-organization" --path ~/github-repos
# Update repositories daily to stay current (could be in a cron job)
github-repo-manager --org "your-organization" --path ~/github-repos
# After updating, if you want to update local branches in a specific repository:
cd ~/github-repos/specific-repo
git status # Check how far behind/ahead you are
git merge origin/main # Merge remote changes into your local branch
# Or if you prefer rebasing:
git rebase origin/main # Rebase your local changes on top of remote changesYou can set up a cron job to automatically update your repositories:
# Edit your crontab
crontab -e
# Add a line to run the tool daily at 9 AM
0 9 * * * export GITHUB_TOKEN="your-token"; /path/to/github-repo-manager --org "your-organization" --path ~/github-reposIf you encounter errors like "permission denied" or "authentication failed":
- Verify your GitHub token has the correct permissions
- Check that your SSH key is properly set up with GitHub
- Ensure your SSH agent is running:
eval "$(ssh-agent -s)" - Try the verbose flag for more detailed output:
github-repo-manager --org "your-org" --path "./repos" --verbose
The tool will automatically detect authentication issues and provide helpful guidance.
The tool automatically checks for newer releases on GitHub when it runs. If a newer version is available, a notice is printed to stderr at the end of the run. This check runs in the background with a 5-second timeout and never blocks the main operation.
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Commit using Conventional Commits (
feat:,fix:, etc.) - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project uses release-please for automated versioning:
- Commit messages must follow Conventional Commits
- On merge to
main, release-please opens/updates a release PR with version bump and CHANGELOG - When the release PR is merged, a Git tag is created
- The tag triggers GoReleaser to build cross-platform binaries and create a GitHub release