https://github.com/lucasnevespereira/go-gituser
Switch between git accounts easily
https://github.com/lucasnevespereira/go-gituser
cli command-line command-line-tool git go golang linux macos open-source opensource producitivity productivity ssh ssh-cli ssh-client ssh-key
Last synced: 28 days ago
JSON representation
Switch between git accounts easily
- Host: GitHub
- URL: https://github.com/lucasnevespereira/go-gituser
- Owner: lucasnevespereira
- License: mit
- Created: 2020-12-11T14:02:11.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2026-04-26T15:12:30.000Z (28 days ago)
- Last Synced: 2026-04-26T15:14:17.566Z (28 days ago)
- Topics: cli, command-line, command-line-tool, git, go, golang, linux, macos, open-source, opensource, producitivity, productivity, ssh, ssh-cli, ssh-client, ssh-key
- Language: Go
- Homepage:
- Size: 2.39 MB
- Stars: 36
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
## Table of Contents
- [Overview](#overview)
- [What It Automates](#what-it-automates)
- [Account Modes](#account-modes)
- [Features](#features)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Commands](#commands)
- [Advanced Features](#advanced-features)
- [Contributing](#contributing)
- [License](#license)
## Overview
As a user of multiple git accounts, I needed to switch regularly between my student, professional, and personal profiles. Manually updating configs, loading SSH keys, and keeping track of identities quickly became tedious.
So I built this open source CLI tool to streamline the whole process.
GitUser helps you switch between different git accounts effortlessly. It automates all the necessary configuration commands: username, email, GPG signing, SSH key loading, so you can focus on coding instead of fiddling with your setup.
Whether you're pushing to school projects, personal repos, or work-related codebases, GitUser makes sure you're always using the right identity with a single command.
## What It Automates
Instead of manually running these commands every time you switch projects:
```bash
git config --global user.name "yourUsername"
git config --global user.email "yourEmail"
git config --global user.signingkey "yourSigningKeyID"
git config --global commit.gpgsign true
ssh-add ~/.ssh/your_ssh_key
```
Just run `gituser work` ✨
## Account Modes
There is currently 3 modes available:
- 💻 work : for a work related git account.
- 📚 school : for a school related git account.
- 🏠 personal : for a personal related git account.
## Features
- **🔄 Instant Account Switching** - Switch between work, school, and personal accounts
- **🔧 Complete Git Configuration** - Manages username, email, and GPG signing
- **🗝️ SSH Key Management** - Automatically loads the correct SSH key for each account
- **🎯 Interactive Setup** - Guided wizard to configure all your accounts
- **🛡️ Secure** - Each account uses its own SSH key for isolation
- **🚀 Zero Configuration After Setup** - One command switches everything
## Installation
### Homebrew (Recommended)
```
brew tap lucasnevespereira/tools
```
```
brew install gituser
```
or
```
brew install lucasnevespereira/tools/gituser
```
### Go Install
```bash
go install github.com/lucasnevespereira/go-gituser@latest
```
### Manual Installation
Make sur your bin path is in your `$PATH`, you can check in your `.zshrc` or `.bash` file.
_e.g_
```shell
export PATH="$HOME/bin:$PATH"
```
Run the following command from the root of the project:
```
make install
```
This will build gituser and move it to your `$HOME/bin`
## Quick Start
Setup your accounts:
```bash
gituser setup
```
Switch between accounts:
```bash
gituser work # Switch to work account
gituser personal # Switch to personal account
gituser school # Switch to school account
```
Check current account:
```bash
gituser now
```
## Commands
| Command | Description |
| ---------------------- | -------------------------------------------------------------- |
| **Account Management** | |
| `gituser setup` | Interactive setup for all accounts (username, email, GPG, SSH) |
| `gituser work` | Switch to work account |
| `gituser personal` | Switch to personal account |
| `gituser school` | Switch to school account |
| **Information** | |
| `gituser now` | Show current active account |
| `gituser info` | Display all configured accounts |
| **SSH Management** | |
| `gituser ssh list` | List SSH keys currently loaded |
| `gituser ssh discover` | Find existing SSH keys on your system |
| `gituser ssh test` | Test SSH connections to GitHub/GitLab |
| `gituser ssh guide` | Show SSH setup guide |
| **Help** | |
| `gituser help` | Show help information |
| `gituser manual` | Show detailed manual |
| `gituser quickstart` | Show quick start guide |
## Advanced Features
### SSH Key Management
GitUser automatically handles SSH keys for each account:
- **Auto-discovery** - Finds existing SSH keys on your system
- **Key generation** - Helps create new SSH keys during setup
- **Automatic switching** - Loads the correct SSH key when switching accounts
- **Connection testing** - Verifies SSH setup works with GitHub/GitLab
### GPG Signing
Configure different GPG keys for each account to enable signed commits with proper identity verification.
## Contributing
If you want to contribute to this project please read the [Contribution Guide](CONTRIBUTING.md).
## License
This project is under [MIT LICENSE](LICENSE)
⭐ If GitUser helps you, please consider giving it a star!