Skip to content
ultimatekristencyPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

Gity - Git Account Manager

Manage multiple Git accounts safely using separate SSH keys for each account.

Why Gity?

If you have multiple GitHub/Codeberg/GitLab accounts (e.g., work + personal) and want to:

  • Keep them isolated and secure
  • Avoid constantly switching SSH keys
  • Have a clean workflow

Gity creates separate SSH keys for each account and auto-configures your ~/.ssh/config so you can use different accounts without conflict.

Installation

# Build from source
cargo build --release

# Copy binary to PATH
sudo cp target/release/gity /usr/local/bin/gity
chmod +x /usr/local/bin/gity

Quick Start

1. Add an Account

# Add a GitHub account
gity add work github
# Enter your email when prompted

# Add a Codeberg account
gity add mycodeberg codeberg

# Add GitLab
gity add personal gitlab

This will:

  • Generate an SSH key: ~/.ssh/id_ed25519_<name>
  • Update ~/.ssh/config with the host alias
  • Show you the public key to add to your git provider

2. Add Public Key to Git Provider

The output shows the public key. Add it to:

3. Verify Connection

gity test work

Should show: ✓ Connection successful!

4. Clone Using Your Account

# Instead of:
git clone git@github.com:username/repo.git

# Use the host alias from gity list:
git clone git@github-work:username/repo.git

Commands

Command Description
gity add <name> <platform> Add a new account (platform: github, gitlab, codeberg, bitbucket)
gity list List all accounts with usage instructions
gity test [name] Test SSH connection to verify key is working
gity remote add Interactive: create remote URL for a specific account
gity remote switch Switch existing remote to different account
gity export Export config to JSON (for backup or moving to another PC)
gity import < file.json Import config from file or stdin
gity remove <name> Remove an account (does NOT delete SSH key files)

Usage Examples

Clone a repo with specific account

# After adding "work" account:
git clone git@github-work:company/project.git

Switch repo to different account

# In your repo directory:
git remote set-url origin git@github-personal:yourname/repo.git

Export/Import for another PC

# On PC 1 - export your setup
gity export > gity-config.json

# Copy SSH keys manually
cp ~/.ssh/id_ed25519_work* /backup/
cp ~/.ssh/id_ed25519_personal* /backup/

# On PC 2 - import config
gity import < gity-config.json

# Copy SSH keys
cp /backup/* ~/.ssh/
chmod 600 ~/.ssh/id_ed25519_*

How It Works

Gity generates an SSH config like this:

Host github-work
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_ed25519_work
  AddKeysToAgent yes
  IdentitiesOnly yes

Host codeberg-codeberg
  HostName codeberg.org
  User git
  IdentityFile ~/.ssh/id_ed25519_codeberg
  AddKeysToAgent yes
  IdentitiesOnly yes

Then you use git@github-work:user/repo instead of git@github.com:user/repo - SSH automatically picks the right key.

Security Notes

  • SSH keys are stored in ~/.ssh/ with 600 permissions
  • Each key is isolated per account
  • Config file is auto-generated (don't manually edit)
  • Use gity test to verify before pushing

Requirements

  • Rust (to build)
  • OpenSSH
  • Git

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors