Skip to content

A CLI tool to manage multiple github ssh keys easily and effectively.

License

Notifications You must be signed in to change notification settings

Filimon4/git-ssh-manager

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git SSH Manager

Git SSH Manager is a simple command-line utility that helps you manage multiple Git SSH profiles with ease. It allows you to create, switch, and remove SSH keys and Git global user configurations (username and email) using straightforward commands.

The Story Behind git-ssh-manager My Journey Building My First CLI Tool

Features

  • Quickly generate new SSH keys and Git profiles
  • Seamlessly switch between profiles for different projects
  • View the current profile and its public key
  • Remove profiles you no longer need

Supported Platforms

  • ✅ Linux
  • ✅ macOS
  • ✅ Windows

Installation

Linux/MacOS

🔧 Option 1: Build from Source

Note: git-ssh-manager requires Go version 1.24.2 or higher if building from source.
  1. Clone the repository:
    
    $ git clone https://github.com/mhbidhan/git-ssh-manager.git
    $ cd git-ssh-manager
          
  2. Build and install:
    
    make install
          

📦 Option 2: Install Precompiled Binary

  1. Download the latest precompiled binary: 👉 Download from Google Drive
  2. Unzip the archive (this shows the file structure):
    
    files
    ├── gsm
    └── install.sh
          
  3. Run the install script:
    
    $ chmod +x install.sh
    $ ./install.sh
          

Windows

🔧 Option 1: Build from Source

Note: git-ssh-manager requires Go version 1.24.2 or higher if building from source.
  1. Clone the repository:
    
    $ git clone https://github.com/mhbidhan/git-ssh-manager.git
    $ cd git-ssh-manager
          
  2. Build and install:
    
    git-ssh-manager
    └── src
        └── build_utils
            └── install.bat
          
  3. Run the install.bat as an Administrator

📦 Option 2: Install Precompiled Binary

  1. Download the latest precompiled binary: 👉 Download from Google Drive
  2. Unzip the archive (this shows the file structure):
    
    /files
    ├── gsm
    └── install.bat
    └── update_path.bat
          
  3. Run the install.bat as an Administrator

✅ Verify Installation

Note: The program might not work on Windows correctly. If it doesn't produce expected results, manually add C:\Program Files\GitSSHManager to your Windows environment paths. Windows sometimes fails to update this automatically.

After installation, check that it works:

$ gsm -h

Expected output:

-gk, --get-key          prints the public key
-l, --list              outputs a list of all available profiles
-s, --status            outputs the active profile
-n, --new               create new profile
-u, --use               use to profile
-r, --remove            remove profile
-h, --help              list all command

Usage

To use git-ssh-manager, simply run the following command:

# gsm --(COMMAND)
$ gsm -s
# or
$ gsm --status

Below are the supported commands:

Command Description
-gk, --get-key Prints the public key of the current profile.
-l, --list Displays a list of all available profiles.
-s, --status Displays the currently active profile.
-n, --new Creates a new profile.
-u, --use Switches to the specified profile.
-r, --remove Removes an existing profile.
-h, --help Lists all available commands and their descriptions.

Examples

# Create a new profile
$ gsm -n profile-name # Promts for username and email

# Switch to a profile
$ gsm -u work

# View current active profile
$ gsm -s

# Get the public key of the profile
$ gsm -gk profile-name

# Remove a profile
$ gsm -r work # Works for non-active profiles

Command Breakdown

gsm -n, --new

Prompts for username and email to create a new SSH profile.
The username and email should match your GitHub (or other remote Git service) identity.

$ gsm -n work
Username: work_user
Email: user@work.com

gsm -u, --use

Activates the specified SSH profile and updates the global Git username and email.

$ gsm -u work
$ git config --list

user.name=work_user
user.email=user@work.com

gsm -gk, --get-key

Prints the public key of the specified profile.
You can copy and add this to your GitHub or other Git host.

gsm -gk work
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFK... user@work.com

About

A CLI tool to manage multiple github ssh keys easily and effectively.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 82.0%
  • Batchfile 15.6%
  • Makefile 2.2%
  • Shell 0.2%