Manage multiple GitHub accounts on a single machine with ease. githubswitch automates the complex process of managing SSH keys, SSH configurations, and Git identities, allowing you to switch between work, personal, or multiple client accounts seamlessly.
- Multi-Account Support: Easily add and manage separate GitHub accounts.
- SSH Key Automation: Automatically generates Ed25519 SSH keys for each account.
- Dynamic SSH Config: Updates your
~/.ssh/configwith host aliases (e.g.,github-work,github-personal). - Git Identity Management: Sets the local repository
user.nameanduser.emailautomatically. - Repo Registration: Clone new repos or register existing ones with the correct account context.
- Add Remote: Quickly link local projects to a GitHub account.
- Interactive CLI: Simple, user-friendly terminal interface.
- Quick Install:
curl -sSL https://raw.githubusercontent.com/Mr-Vishal-Ranjan/github-switch/main/githubswitch -o githubswitch && chmod +x githubswitch - Move to PATH (optional):
sudo mv githubswitch /usr/local/bin/
(Note: Windows users should run these commands in Git Bash).
- Run the script:
./githubswitch
- Initial Setup: The first time you run it, you'll be prompted to set up your accounts. You'll need to copy the generated SSH keys to your GitHub settings (links are provided in the script).
- Add a Repository:
- Choose Add / Clone Repo to start working on a project.
- The script will configure the remote URL and local identity automatically.
- Link an Existing Project:
- Choose Add Remote to Project to link a local folder to a GitHub account.
- Add / Clone Repo: Clone from GitHub or register an existing folder.
- Add Remote to Project: Initialize Git and add a GitHub remote.
- Add Account: Setup a new GitHub account and generate its key.
- Show All Accounts: List all managed accounts and their linked repositories.
- Show SSH Key: Display the public key for any managed account.
- Delete Account: Safely remove an account and its keys.
- Destroy All: Completely remove all
githubswitchconfigurations.
githubswitch stores its configuration in ~/.ssh/githubswitch.conf and creates SSH keys in ~/.ssh/. It sets proper 600 permissions for these sensitive files.
If you find githubswitch helpful, consider supporting its development!
If you have any questions, suggestions, or just want to say hi, feel free to reach out:
- Email: mr.vishalranjan007@gmail.com
- GitHub: @Mr-Vishal-Ranjan
This project is licensed under the MIT License.
Contributions are welcome! Feel free to open an issue or submit a pull request.