Skip to content

TheFel0x/chgit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build & Test Crates.io Version Build & Test Beta Crates.io Pre-release

chgit

Quickly switch between your identities, without having to deal with git config files.

I originally had a little script that did this but I wanted something that I can use on both Linux and Windows!

SSH-Agent Setup

Windows

The OpenSSH agent might be disabled by default on Windows. Run the following commands in an elevated (Administrator) PowerShell:

# Allow ssh-agent to be started
Set-Service ssh-agent -StartupType Manual  
# Start ssh-agent
Start-Service ssh-agent
# Automatically start ssh-agent at boot from now on
Set-Service ssh-agent -StartupType Automatic 

If all three commands are executed this is a one time setup and can be skipped in the future.

Linux

Ensure your ssh-agent is running.

eval "$(ssh-agent -s)"

Consider adding this to your shell's startup file (e.g., ~/.bashrc or ~/.zshrc) or your profile script.

macOS

Should be the same as Linux? Not sure, I don't have a macOS machine to test this.

Basic Usage

  1. Create a new profile:
chgit add <PROFILE_NAME> <USER_NAME> <EMAIL> <SSH_KEY> [--gpg-key <GPG_KEY>]

Examples:

# Linux example
chgit add Private "John Doe" "john.doe@example.com" "/home/john/.ssh/id_rsa_work"
# Linux example with GPG signing
chgit add Private "John Doe" "john.doe@example.com" "/home/john/.ssh/id_rsa_work" --gpg-key ABC1234567
# Windows example
chgit.exe add Private "John Doe" "john.doe@example.com" "C:\Users\John\.ssh\id_rsa_work"
  1. List profiles:
chgit list
  1. Switch to a profile:
chgit switch <PROFILE_NAME>

Autopaths

  1. Add an autopath:
chgit set-auto <PROFILE_NAME> [PATH]

If no path is provided, the current working directory will be used.

  1. Auto switch depending on the current path:
chgit auto

Other Commands

  • chgit remove <PROFILE_NAME>: Remove a profile.
  • chgit info <PROFILE_NAME>: Show full details of a profile.
  • chgit check-profile: Check the active profile. (if any)
  • chgit add-current <PROFILE_NAME>: Create a new profile with the current git config values.
  • chgit check-git-config: Quickly check the current git config values.
  • chgit unset: Unset the local git name and email.
  • chgit help: Show the help message.

About

Git Profile Helper

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages