git-userhub 2.1.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +153 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,42 +1,178 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<br />
|
|
3
|
+
<img src="https://raw.githubusercontent.com/divyo-argha/git-user/main/img/git-user-logo-clean.png" alt="git-user" width="100" height="100" style="border-radius:22px" />
|
|
4
|
+
<h1>git-user</h1>
|
|
2
5
|
|
|
3
|
-
>
|
|
6
|
+
<p>
|
|
7
|
+
<strong>Switch Git identities in one command.</strong><br />
|
|
8
|
+
No config editing. No SSH key chaos. No wrong-account commits.
|
|
9
|
+
</p>
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
<p>
|
|
12
|
+
<a href="https://www.npmjs.com/package/git-userhub"><img src="https://img.shields.io/npm/v/git-userhub?style=flat-square&color=CB3837&logo=npm&logoColor=white" alt="npm version" /></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/git-userhub"><img src="https://img.shields.io/npm/dm/git-userhub?style=flat-square&color=CB3837&logo=npm&logoColor=white" alt="downloads" /></a>
|
|
14
|
+
<a href="https://github.com/divyo-argha/git-user/releases"><img src="https://img.shields.io/github/v/release/divyo-argha/git-user?style=flat-square&color=00FFAA&label=latest" alt="Latest Release" /></a>
|
|
15
|
+
<a href="https://github.com/divyo-argha/git-user/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-22c55e?style=flat-square" alt="MIT" /></a>
|
|
16
|
+
</p>
|
|
6
17
|
|
|
7
|
-
|
|
18
|
+
<img src="https://img.shields.io/badge/GitHub-supported-181717?style=for-the-badge&logo=github&logoColor=white" alt="GitHub" />
|
|
19
|
+
<img src="https://img.shields.io/badge/GitLab-supported-FC6D26?style=for-the-badge&logo=gitlab&logoColor=white" alt="GitLab" />
|
|
20
|
+
<img src="https://img.shields.io/badge/Bitbucket-supported-0052CC?style=for-the-badge&logo=bitbucket&logoColor=white" alt="Bitbucket" />
|
|
21
|
+
|
|
22
|
+
<br /><br />
|
|
23
|
+
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
> **Note on the package name:** This package is published as `git-userhub` on npm. After installation, the CLI command is `git-user`. The npm name is just the registry identifier — everything you run is `git-user`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Install
|
|
8
33
|
|
|
9
34
|
```bash
|
|
10
35
|
npm install -g git-userhub
|
|
11
36
|
```
|
|
12
37
|
|
|
13
|
-
|
|
38
|
+
That's it. The `git-user` command is now available in your terminal.
|
|
14
39
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## The Problem It Solves
|
|
43
|
+
|
|
44
|
+
You have a work account, a personal account, maybe a freelance client or two. Every few weeks you push commits with the wrong email. Your personal address ends up in a client's repo history. Your work email leaks onto your public GitHub profile.
|
|
45
|
+
|
|
46
|
+
git-user fixes this permanently. Register your identities once, switch with one command.
|
|
47
|
+
|
|
48
|
+
---
|
|
18
49
|
|
|
19
50
|
## Quick Start
|
|
20
51
|
|
|
21
52
|
```bash
|
|
22
|
-
#
|
|
23
|
-
git-user register
|
|
53
|
+
# Register your identities (guided, takes ~2 minutes each)
|
|
54
|
+
git-user register # name: work, email: you@company.com
|
|
55
|
+
git-user register # name: personal, email: you@gmail.com
|
|
24
56
|
|
|
25
|
-
# Switch between
|
|
57
|
+
# Switch between them instantly
|
|
26
58
|
git-user switch work
|
|
27
59
|
git-user switch personal
|
|
28
60
|
|
|
29
|
-
#
|
|
30
|
-
git-user list
|
|
31
|
-
|
|
32
|
-
# Check current identity
|
|
61
|
+
# See what's active
|
|
33
62
|
git-user current
|
|
63
|
+
|
|
64
|
+
# Create and switch in one step
|
|
65
|
+
git-user switch -c freelance me@freelance.com
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## What It Does on Switch
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
git-user switch work
|
|
74
|
+
│
|
|
75
|
+
▼
|
|
76
|
+
1. Reads "work" from ~/.git-users/config.json
|
|
77
|
+
2. Sets ~/.gitconfig → user.name, user.email
|
|
78
|
+
3. Sets ~/.gitconfig → core.sshCommand (your SSH key)
|
|
79
|
+
4. Verifies SSH connection
|
|
80
|
+
5. ✅ Done — under one second
|
|
34
81
|
```
|
|
35
82
|
|
|
36
|
-
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Key Features
|
|
86
|
+
|
|
87
|
+
| Feature | Description |
|
|
88
|
+
|---------|-------------|
|
|
89
|
+
| 🔑 **Identity switching** | Name + email + SSH key as one atomic unit |
|
|
90
|
+
| 🔐 **SSH key management** | Auto-generate ed25519 keys, bind existing keys |
|
|
91
|
+
| 🔒 **Temporary sessions** | Use an identity on a shared machine — zero trace left behind |
|
|
92
|
+
| 🛡️ **Security audit** | `git-user security` checks permissions and passphrase protection |
|
|
93
|
+
| 🚀 **HTTPS → SSH** | `git-user fix-remote` converts remotes for passwordless push |
|
|
94
|
+
| 🪝 **Pre-commit hooks** | Block commits if the wrong identity is active |
|
|
95
|
+
| 📦 **Export/import** | Move all identities to a new machine, AES-256 encrypted |
|
|
96
|
+
| 🖥️ **TUI** | Interactive menu for everything |
|
|
97
|
+
| 🐚 **Shell completions** | bash, zsh, fish |
|
|
37
98
|
|
|
38
|
-
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Temporary Sessions
|
|
102
|
+
|
|
103
|
+
Working on a borrowed machine? Don't want to leave SSH keys behind?
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Start a temporary session — nothing is saved permanently
|
|
107
|
+
git-user session start --temp alice me@work.com --ttl 2h
|
|
108
|
+
|
|
109
|
+
# When done — key files deleted, previous identity restored
|
|
110
|
+
git-user session stop
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## All Commands
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
register Create new identity (guided)
|
|
119
|
+
switch <name> Switch to an identity
|
|
120
|
+
switch -c <name> [email] Create and switch in one step
|
|
121
|
+
list Show all identities
|
|
122
|
+
current Show active identity
|
|
123
|
+
remove <name> Delete an identity
|
|
124
|
+
edit <name> <email> Update email
|
|
125
|
+
bind <name> Link an SSH key
|
|
126
|
+
passphrase Change passphrase for active identity
|
|
127
|
+
rekey <name> Rotate SSH key
|
|
128
|
+
fix-remote Convert HTTPS remotes to SSH
|
|
129
|
+
session start [--ttl <d>] Load SSH key into ssh-agent
|
|
130
|
+
session start --temp ... Temporary session (nothing saved)
|
|
131
|
+
session stop Unload key / end temp session
|
|
132
|
+
session status Show agent status
|
|
133
|
+
security Audit all identities
|
|
134
|
+
export --all Export encrypted bundle
|
|
135
|
+
import <file> Import from bundle
|
|
136
|
+
doctor Full health check
|
|
137
|
+
tui Interactive menu
|
|
138
|
+
completion <shell> Shell completions
|
|
139
|
+
hook install|uninstall Pre-commit identity guard
|
|
140
|
+
--update Update to latest version
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Aliases:** `ls` → `list` · `sw` → `switch` · `rm` → `remove`
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## What Gets Modified
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
~/.git-users/config.json ← your identities (never auto-deleted)
|
|
151
|
+
~/.gitconfig ← updated on every switch
|
|
152
|
+
~/.ssh/git_<name> ← private key (stays on your machine)
|
|
153
|
+
~/.ssh/git_tmp_<name> ← temp session key (deleted on stop)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Your repositories are never touched.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Full Documentation
|
|
161
|
+
|
|
162
|
+
**→ [github.com/divyo-argha/git-user](https://github.com/divyo-argha/git-user)**
|
|
163
|
+
|
|
164
|
+
---
|
|
39
165
|
|
|
40
166
|
## License
|
|
41
167
|
|
|
42
168
|
MIT
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
<div align="center">
|
|
173
|
+
|
|
174
|
+
[](https://github.com/divyo-argha/git-user)
|
|
175
|
+
|
|
176
|
+
<sub>If git-user saved you from a wrong-account commit, consider giving it a ⭐</sub>
|
|
177
|
+
|
|
178
|
+
</div>
|