Skip to content

Bash script designed to help those with multiple Github SSH keys on a machine. Allowing for quick and easy switching between personal and work Github SSH keys.

Notifications You must be signed in to change notification settings

FouL06/SSH-Switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

SSH-Switch

A lightweight Bash utility for developers managing multiple GitHub accounts on a single machine. Seamlessly switch between personal and work SSH keys with a single command.

Problem it Solves

Working with multiple GitHub accounts (personal and work) on the same machine requires constantly updating SSH configurations. SSH-Switch automates this process, eliminating the manual hassle of editing ~/.ssh/config and managing different SSH keys.

Features

  • Quick Switching: Toggle between personal and work GitHub SSH keys instantly
  • Automation: No manual config file editing required
  • Simple CLI: Single script execution to change active SSH key
  • Cross-Platform: Works on macOS, Linux, and WSL

Prerequisites

  • Bash shell
  • Multiple SSH keys already generated for different GitHub accounts
  • SSH keys stored in ~/.ssh/ directory

Installation

  1. Clone the repository:
git clone https://github.com/FouL06/SSH-Switch.git
cd SSH-Switch
  1. Make the script executable:
chmod +x sshswitch.sh
  1. (Optional) Add to PATH for global access:
sudo cp sshswitch.sh /usr/local/bin/sshswitch

Usage

Run the script and follow the prompts:

./sshswitch.sh

Or if installed globally:

sshswitch

The script will:

  1. Display your current SSH keys
  2. Prompt you to select which key to activate
  3. Update your SSH configuration automatically
  4. Confirm the switch

Configuration

Ensure your SSH keys follow standard naming conventions:

  • Personal: id_rsa or id_ed25519
  • Work: id_rsa_work or id_ed25519_work

The script automatically detects available keys in ~/.ssh/ directory.

Use Case

Perfect for developers who:

  • Maintain separate GitHub accounts for work and personal projects
  • Need to frequently switch contexts between different organizations
  • Want to automate SSH key management without manual configuration

Contributing

Contributions welcome! Feel free to open issues or submit pull requests.

Topics

github ssh automation shell management githubcli shell-script

About

Bash script designed to help those with multiple Github SSH keys on a machine. Allowing for quick and easy switching between personal and work Github SSH keys.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages