#ssh-key #account #git #command #github #fingertips

app gitshift

Git SSH at your fingertips

1 unstable release

new 0.1.0 Jan 27, 2025

#35 in Email

28 downloads per month

MIT license

15KB
243 lines

GitShift 🔀

Rust License: MIT

A secure CLI tool for managing multiple GitHub accounts with SSH keys. Switch between work and personal accounts seamlessly! 🔐

GitShift Demo

Features ✨

  • 🧩 Multi-Account Management - Store unlimited GitHub accounts
  • 🔒 Secure Storage - Automatically handles SSH key permissions
  • 🚀 Context-Aware Operations - Clone/push with active account credentials
  • 📋 Interactive Setup - Guided account creation process
  • 🌐 Cross-Platform - Works on Linux, macOS, and Windows

Installation 📦

cargo install --git https://github.com/yourusername/gitshift.git

From crates.io

cargo install gitshift

Quick Start 🚀

  1. Add New Account
gitshift add --name work --algorithm ed25519
  1. List Accounts
gitshift ls
  1. Activate Account
gitshift activate work
  1. Clone Repository
gitshift clone git@github.com:company/project.git

Configuration ⚙️

File Structure

~/.config/gitshift/
├── config.json    # Account configurations
├── state.json     # Active account state
└── ssh_keys/      # SSH key storage (700 permissions)

Example config

[
    {
        "name": "work",
        "email": "dev@company.com",
        "ssh_key_path": "~/.config/gitshift/ssh_keys/work_id",
        "public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1..."
    }
]

Command Reference 📚

Command | Description | Example add | Create new account | gitshift add --name dev --algorithm rsa ls | List accounts | gitshift ls activate | Switch account | gitshift activate personal clone | Clone repository | gitshift clone git@github.com:user/repo.git

Development 🛠️

Build Instructions

git clone https://github.com/yourusername/gitshift.git
cd gitshift
cargo build --release

Troubleshooting 🐞

Q: Getting "Permission denied" when cloning A:

  1. Verify active account: gitshift ls

  2. Check GitHub SSH setup: ssh -T git@github.com

  3. Confirm key permissions: ls -la ~/.config/gitshift/ssh_keys

Q: Error saving configuration A: Ensure proper directory permissions:

chmod 700 ~/.config/gitshift

Dependencies

~7–16MB
~215K SLoC