New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gssh

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gssh

SSH + Git author profile manager

latest
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

gssh - SSH + Git Author Profile Manager

A cross-platform Node.js CLI tool that manages multiple SSH keys and Git author profiles.

Features

  • Profile-based SSH key management: Switch between different SSH identities with a single command
  • Git author configuration: Automatically set Git user.name and user.email (global or local)
  • Auto-import existing keys: Automatically detects and offers to import existing SSH keys on first run
  • Public key display: Easily copy your public key to clipboard for GitHub/GitLab
  • Cross-platform: Works on macOS, Linux, and Windows (Node.js 18+)

Installation

From Source

cd gssh-node
npm install
npm run build

# Install globally (optional)
npm link

From npm

npm install -g gssh

Usage

List all profiles

gssh list

Create a new profile

gssh add myprofile
# Interactive wizard will prompt for Git author name, email, and generate SSH key

Switch to a profile

# Set Git config globally (default)
gssh use myprofile

# Set Git config locally (current repo only)
gssh use myprofile -l

Show current active profile

gssh current

Display public key

gssh pubkey
# Automatically copies to clipboard (macOS/Linux/Windows)

Remove a profile

gssh remove myprofile
# Safety checks prevent accidental deletion of active profile

Show menu (default)

gssh
# Shows menu, current profile, and public key

How It Works

Profile Storage

Profiles are stored in ~/.ssh/profiles/<profile-name>/:

~/.ssh/profiles/
├── work/
│   ├── id_ed25519          # Private key
│   ├── id_ed25519.pub      # Public key
│   └── git_author.txt      # Git author info
└── personal/
    ├── id_ed25519
    ├── id_ed25519.pub
    └── git_author.txt

Active Profile Tracking

Active profile is tracked using two methods:

  • Marker file (preferred): ~/.ssh/git-ssh-active.txt
  • Public key matching (fallback): Compares public keys in ~/.ssh/ with profile keys

Git Author Format

The git_author.txt file supports two formats:

Single line:

John Doe <john@example.com>

Two lines:

John Doe
john@example.com

Technical Details

Stack

  • TypeScript with ESM modules
  • commander - CLI parsing
  • chalk - Terminal colors
  • execa - Shell command execution
  • fast-glob - Directory traversal

Architecture

src/
├── index.ts           # Main entry point
├── cli.ts             # Commander.js setup
├── types.ts           # TypeScript interfaces
├── paths.ts           # Filesystem path management
├── git-author.ts      # Git config management
├── keypair.ts         # SSH key operations
├── utils/
│   ├── clipboard.ts   # Platform-specific clipboard
│   ├── prompts.ts     # Interactive prompts
│   ├── errors.ts      # Error handling
│   └── platform.ts    # Platform detection
└── commands/
    ├── list.ts        # List profiles
    ├── use.ts         # Switch profiles
    ├── add.ts         # Create profiles
    ├── remove.ts      # Delete profiles
    ├── current.ts     # Show active profile
    ├── pubkey.ts      # Display public key
    ├── import.ts      # Auto-import existing keys
    ├── menu.ts        # Default menu
    └── shared.ts      # Shared utilities

File Permissions

On Unix-like systems (macOS, Linux):

  • Private keys: chmod 600 (read-only by owner)
  • Public keys: chmod 644 (readable by all)

On Windows: Relies on NTFS permissions (not explicitly managed)

Clipboard Support

Platform-specific clipboard commands:

  • macOS: pbcopy
  • Windows: clip
  • Linux: xclip, xsel, wl-copy (tries multiple)

Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Watch mode (development)
npm run dev

# Clean build artifacts
npm run clean

Differences from Rust Version

  • Uses Node.js native readline instead of external prompt libraries
  • Uses execa for shell commands instead of std::process::Command
  • Modular file structure vs single-file binary
  • Same CLI interface and functionality

Requirements

  • Node.js 18 or higher
  • ssh-keygen (for generating keys)
  • git (for setting config)

License

MIT

Keywords

ssh

FAQs

Package last updated on 07 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts