GiMan®

Unit / D-01 /// SSH git Identity Control /// Rev 1.0.5 /// Node ≥ 18

Git Identities, Managed.

Personal and work GitHub accounts on one machine, without the SSH config archaeology. Map a directory to an identity once — every repo inside it commits, clones, and authenticates as the right user, permanently.

npm install -g giman
Package
giman
Binary
gid
Version
1.0.5
Runtime
Node ≥ 18
Transport
SSH
Files touched
03
Reversible
Yes
License
MIT
00 / Session Log Transcript — verbatim
[ Bash — gid ] TTY / 001  ·  Exit 0
$gid init
Initializing GiMan configuration… Done.
$gid dir add ~/dev/personal --identity personal
Directory mapped: ~/dev/personalpersonal
$gid dir add ~/dev/work --identity work
Directory mapped: ~/dev/workwork
$gid clone git@github.com:company/project.git
Using identity: work
Rewriting host → github-work
Cloning into 'project'…
[ 001 ]

Total npm downloads

[ 002 ]

1.0.5

Latest version

[ 003 ]

MIT

License

01 / Capabilities Three primitives

Set it once.
Never think
about it again.

GiMan is a thin, auditable layer over primitives Git and SSH already have. It writes plain text you can read, and unwrites it just as cleanly.

01Setup

Quick setup

Initialize with a single command. No config files to hand-edit, no key paths to memorize.

gid init
02Routing

Context aware

Switches SSH keys and commit identity based on the directory you're working in. No shell hooks, no aliases.

gid dir add <path>
03Control

Full control

Inspect, edit, and apply from the terminal. Every write is marked and reversible.

gid status gid id list gid apply
02 / Mechanism Three files — all reversible

How it works

GiMan manages exactly three files on your behalf. Every change is opt-in, marked, and safe to re-run.

F-01Source of truth

~/.giman/config.json

Stores identities, SSH key paths, and directory mappings. Edit it by hand or drive it with gid id commands.

F-02Commit identity

~/.gitconfig

GiMan appends includeIf "gitdir:…" blocks that activate a per-identity gitconfig for specific directories automatically.

F-03Key selection

~/.ssh/config

GiMan writes Host alias blocks — e.g. github-personal — mapping to github.com with the matching SSH key.

02.1 / Quick start Seven steps — cold machine to first commit
01Install
$npm install -g giman
02First identity
$gid init Enter ID (e.g. "personal"), name, email, SSH host alias (e.g. "github-personal") Generate a new SSH key or select an existing one
03Second identity
$gid id add Repeat for the "work" identity
04Map directories
$gid dir add ~/dev/personal --identity personal $gid dir add ~/dev/work --identity work
05Verify
$cd ~/dev/work/my-project $gid status Identity: work — Jane Work <jane@company.com>
06Clone
$gid clone git@github.com:company/project.git Prompts to pick an identity, then clones with the rewritten URL
07Commit
$git commit -m "feat: add feature" Committed as: Jane Work <jane@company.com>
03 / Changelog 3 releases on record

Changelog

What changed in each release.

v1.0.5 2026-07-28 Bugfix
Change

gid identity renamed to gid id

The subcommand group is now gid idlist, add, edit, remove, show are unchanged. gid identity still works as an alias, so existing scripts keep running.

Fix

gid id remove now cleans up ~/.gitconfig includeIf entries

Removing an identity previously left stale [includeIf] blocks pointing at deleted gitconfig files. These are now pruned on removal.

Fix

SSH host alias now requires valid hostname characters only

Spaces and special characters are rejected at input. Previously, entering github my work would write a broken Host github my work entry — three patterns instead of one.

Fix

SSH keygen: disconnected inherited stdin and unread stdout pipe

The ssh-keygen subprocess previously inherited the parent's terminal stdin and had stdout piped but never consumed. Changed to ['ignore', 'ignore', 'pipe'] — only stderr is captured, for error reporting.

Fix

resolveHome('$HOME') now correctly expands to the home directory

Bare $HOME (without trailing slash) was returned as the literal string. It is now expanded the same way as $HOME/ and ~/.

Fix

gid dir add now resolves relative paths against CWD

Paths like ./subdir, ., and ../other are expanded to absolute paths before being stored. Previously they were saved as-is, causing gid status to never match — the relative path resolved against whichever directory you happened to run the next command from.

Chore

Merged duplicate import in status.ts

Two separate import statements from ../services/config.js were consolidated into one.

v1.0.3 2025-10-12 Feature
Feat

Added gid clone command

Clone a GitHub repo via SSH with interactive identity selection. GiMan rewrites the URL to use the chosen identity's host alias automatically.

Feat

Path traversal guard on SSH key and gitconfig paths

Identity IDs are validated against /^[a-zA-Z0-9_-]+$/ and paths are asserted to stay within their expected base directories.

v1.0.0 2025-08-01 Initial release
Feat

Core identity management — gid init, gid identity add/edit/remove/show/list

Create and manage multiple git identities (name, email, SSH key, host alias) stored in ~/.giman/config.json.

Feat

Directory mappings via gid dir add/remove/list

Map a directory to an identity so git automatically uses the right user and SSH key for any repo inside that path.

Feat

SSH config and gitconfig sync via gid apply

Writes Host blocks to ~/.ssh/config and includeIf rules to ~/.gitconfig. All changes are opt-in, and GiMan markers make them safe to re-run.

04 / Install One command

Stop editing
SSH config
by hand.

npm install -g giman