@mckinleymedia/gitswitch
v2.0.0
Published
Professional Git profile manager with SSH key management for GitHub, GitLab, and Bitbucket
Downloads
8
Maintainers
Readme
gitswitch
A professional Git profile manager with SSH key management for GitHub, GitLab, and Bitbucket.
Features
- 🔄 Quick switching between multiple Git profiles
- 🔑 Automatic SSH key generation and management
- 🔒 Secure storage of profile configurations
- 🎯 Support for GitHub, GitLab, and Bitbucket
- 📋 Profile listing with current status
- ✏️ Easy profile editing and removal
- 🔍 SSH connection testing
- 📝 Interactive and command-line modes
Installation
npm install -g @mckinleymedia/gitswitchOr using yarn:
yarn global add @mckinleymedia/gitswitchUsage
Initialize GitSwitch
Set up your first Git profile:
gitswitch initAdd a New Profile
Add additional Git profiles:
gitswitch addSwitch Profiles
Switch to a different profile:
# Interactive mode (select from list)
gitswitch switch
# Direct switch
gitswitch switch work
# Using the short alias
gitswitch switch personalList All Profiles
View all configured profiles:
gitswitch listEdit an Profile
Modify profile details:
gitswitch edit <profile-name>Remove an Profile
Delete an profile configuration:
gitswitch remove <profile-name>Generate SSH Key
Create a new SSH key for an profile:
gitswitch ssh <profile-name>Command Reference
Commands:
init [options] Initialize GitSwitch with your first profile
add [options] Add a new Git profile
switch [profile] [options] Switch to a different Git profile
list [options] List all Git profiles
edit <profile> Edit an existing profile
remove <profile> Remove a Git profile
ssh <profile> [options] Generate new SSH key for an profile
current Show current Git configuration
help [command] Display help for command
Options:
-V, --version output the version number
-h, --help display help for commandSSH Key Management
GitSwitch automatically manages SSH keys for your profiles:
- Key Generation: Creates Ed25519 SSH keys (most secure and efficient)
- Key Storage: Saves keys in
~/.ssh/with proper permissions (600) - Connection Testing: Automatically tests SSH connectivity when switching profiles
- Service URLs: Provides direct links to add your public keys to GitHub/GitLab/Bitbucket
Adding SSH Keys to Git Services
After generating an SSH key, add it to your Git service:
- GitHub: https://github.com/settings/keys
- GitLab: https://gitlab.com/-/profile/keys
- Bitbucket: https://bitbucket.org/profile/settings/ssh-keys/
Configuration
GitSwitch stores its configuration in ~/.gitswitch.json. This file contains:
- Profile names and emails
- SSH key paths
- Git service types
- Profile metadata
Backup
GitSwitch automatically creates backups before destructive operations.
Security
- SSH keys are stored with secure permissions (600)
- No passwords or tokens are stored
- All operations use native Git and SSH commands
- SSH connections explicitly disable password authentication
Examples
Setting Up Multiple Work and Personal Profiles
# Initialize with personal profile
gitswitch init
# Enter: personal, John Doe, [email protected], GitHub
# Add work profile
gitswitch add
# Enter: work, John Doe, [email protected], GitLab
# Switch between profiles
gitswitch switch work
gitswitch switch personalManaging SSH Keys
# Generate new SSH key for work profile
gitswitch ssh work
# The public key will be copied to clipboard
# Add it to your GitLab profile settingsTroubleshooting
SSH Connection Issues
If SSH connections fail:
- Ensure your SSH key is added to the Git service
- Check key permissions:
ls -la ~/.ssh/ - Test connection manually:
ssh -T [email protected]
Git Config Not Updating
Ensure you have proper permissions to modify Git config:
git config --global --listContributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Will McKinley - mckinleymedia
