A command-line tool for managing multiple GitHub accounts on a single machine.
Using Go:
go install github.com/catoncat/ghs@latestOr build from source:
# Build the program
go build -o ghs
# Move to system path
sudo mv ghs /usr/local/bin/ghs add
# Interactive setup for new GitHub account
# - Set account alias, username, name, email
# - Configure SSH key (auto-generate if needed)
# - Link GPG key if available# Clone repository and auto-configure if it's yours
# - Uses SSH configuration
# - Sets up Git user info
# - Configures GPG signing if key exists
ghs clone https://github.com/owner/repo.git# Switch repository configuration:
# - Updates Git user info
# - Sets GPG signing key if available
cd your-repository
ghs switch workghs list # List all accounts
ghs current # Show current repository's git configuration
ghs help # Show help information- Program config:
~/.github-switcher.json - SSH config:
~/.ssh/config
Each account has its own Host configuration:
# GitHub account: work
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_work
IdentitiesOnly yes