Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/erickm13/Salchipapa.Dots/llms.txt

Use this file to discover all available pages before exploring further.

The SalchipapaGit/ directory contains four standalone bash scripts that handle the full lifecycle of multi-account GitHub SSH access. They use the gh-<keyname> SSH host alias convention — for example gh-personal or gh-work — and wire each alias to a per-directory [includeIf "gitdir:~/<dir>/"] block in ~/.gitconfig, so Git automatically uses the right identity depending on which folder you are working in.

Overview

Each script is a standalone Bash program. They are not run via the main installer — you must invoke them directly from the repo root:

setup-git-users

First-time setup. Creates ~/.gitconfig, ~/.ssh/config, and SSH ed25519 keys for one main account plus any number of optional extras.

add-git-user

Adds a new GitHub account to an existing setup without touching other accounts.

clone-repo

Clones a repository using a specific SSH identity, rewriting the host alias automatically.

user-delete

Permanently removes an SSH account — key files, SSH config block, and gitconfig entries.

SSH host alias convention

Every GitHub account is mapped to a unique SSH Host alias following the pattern gh-<keyname>. For example:
Host gh-personal
    HostName github.com
    User git
    IdentityFile ~/.ssh/personal

Host gh-work
    HostName github.com
    User git
    IdentityFile ~/.ssh/work
When you clone or push, you substitute github.com with the alias (e.g. git@gh-work:myorg/repo.git). The clone-repo script does this substitution for you automatically.

Per-account gitconfig

Each extra account gets its own ~/.gitconfig-<keyname> file containing its [user] block. This file is activated transparently by an [includeIf] directive in ~/.gitconfig:
[user]
    name  = Main User
    email = main@example.com

[includeIf "gitdir:~/work/"]
    path = ~/.gitconfig-work

[init]
    defaultBranch = main
Any repository that lives under ~/work/ will automatically use the work identity. Repositories anywhere else fall back to the global [user] block.

setup-git-users

setup-git-users performs a full first-time provisioning of your Git and SSH environment from scratch.

What it does

1

Prompt for main account

Asks for the username, email, and SSH key name for your primary GitHub account. The key name becomes the file name under ~/.ssh/ and the suffix of the gh-<keyname> alias.
2

Optionally add extra accounts

Presents a numbered menu to add additional accounts. For each extra account you provide a username, email, and the name of the home-directory folder that will belong to that identity (e.g. work).
3

Write ~/.gitconfig

Generates ~/.gitconfig with the main [user] block, one [includeIf "gitdir:~/<dir>/"] entry per extra account, and [init] defaultBranch = main.
4

Write per-account gitconfig files

Creates ~/.gitconfig-<dir> for every extra account, containing that account’s [user] block.
5

Write ~/.ssh/config

Generates a clean ~/.ssh/config with Host gh-<keyname> entries for the main account and every extra account.
6

Generate SSH ed25519 keys

Runs ssh-keygen -t ed25519 for each account. Prompts for an optional passphrase (with confirmation). Skips generation if the key file already exists.
7

Set correct permissions

Applies chmod 700 ~/.ssh, chmod 600 on private keys and ~/.ssh/config, and chmod 644 on .pub files.

Usage

bash SalchipapaGit/setup-git-users

add-git-user

add-git-user appends a new GitHub account to an existing setup. It requires that ~/.gitconfig already exists — run setup-git-users first.

What it does

1

Validate existing setup

Exits with an error if ~/.gitconfig is not found.
2

Prompt for account info

Asks for username, email, key name, and directory. The key name is automatically stripped of any gh- prefix you might type, so both work and gh-work produce the same result.
3

Append includeIf to ~/.gitconfig

Inserts [includeIf "gitdir:~/<dir>/"] before the [init] section (or appends to the end of the file if no [init] block exists). Skips if an entry for that directory is already present.
4

Create ~/.gitconfig-<keyname>

Writes a new ~/.gitconfig-<keyname> file with the provided name and email.
5

Append Host entry to ~/.ssh/config

Adds a Host gh-<keyname> block pointing HostName github.com and the new IdentityFile. Skips if the host is already defined.
6

Generate SSH key

Calls ssh-keygen -t ed25519 with passphrase confirmation. Skips if the key file already exists.

Usage

bash SalchipapaGit/add-git-user

clone-repo

clone-repo clones a GitHub repository using a chosen SSH identity, automatically rewriting github.com to the correct gh-<keyname> host alias.

What it does

1

List available identities

Reads all *.pub files from ~/.ssh/, strips the .pub extension, and displays them as a numbered list with their key comments.
2

Select identity

Prompts you to pick a number. The selected key name becomes gh-<keyname>.
3

Prompt for repo URL

Asks for the full git@github.com:user/repo.git URL. Exits with an error if the URL does not start with git@github.com:.
4

Rewrite host alias

Replaces github.com with gh-<keyname> in the URL using sed, producing the correct per-identity remote address.
5

Add key and clone

Runs ssh-add ~/.ssh/<keyname> to load the key into the agent, then executes git clone with the rewritten URL.

Host rewrite example

# Instead of:
git clone git@github.com:myorg/project.git

# clone-repo uses:
git clone git@gh-work:myorg/project.git

Usage

bash SalchipapaGit/clone-repo

user-delete

user-delete permanently removes a GitHub SSH account — its key pair, SSH config entry, gitconfig include, and per-account gitconfig file.

What it does

1

List available SSH keys

Scans ~/.ssh/ for *.pub files and presents them as a numbered list.
2

Select key to remove

Prompts for a number. The selected key name is used for all subsequent deletions.
3

Confirm deletion

Displays every file and config block that will be affected, then asks for an explicit y/N confirmation. Cancels cleanly on any other input.
4

Remove key files

Deletes ~/.ssh/<keyname> and ~/.ssh/<keyname>.pub.
5

Remove ~/.gitconfig-<keyname>

Deletes the per-account gitconfig file if it exists.
6

Remove SSH config block

Uses sed to strip the Host gh-<keyname> block from ~/.ssh/config.
7

Remove includeIf from ~/.gitconfig

Uses sed to remove the matching [includeIf] line and its path = line from ~/.gitconfig.

Usage

bash SalchipapaGit/user-delete
user-delete permanently removes SSH key files and config entries. This action cannot be undone. Back up ~/.ssh/ before running the script if you need to keep the keys.

Adding a public key to GitHub

After running any script that generates a key, copy the public key and paste it into GitHub Settings → SSH and GPG keys → New SSH key:
cat ~/.ssh/<keyname>.pub
Each account needs its own key added to the corresponding GitHub account. After pasting the key, you can verify connectivity with ssh -T git@gh-<keyname> — a successful response reads “Hi <username>! You’ve successfully authenticated…”.

Build docs developers (and LLMs) love