π Secure CLI to manage multiple GitHub/GitLab accounts with per-folder git credentials
If you work with multiple GitHub/GitLab accounts (personal, work, client projects), managing different credentials for each repository can be painful. git-context solves this by:
- β Storing multiple git profiles securely in the cloud
- β Applying per-folder git configurations
- β Cloning repositories without credential prompts
- β Encrypting sensitive tokens locally
- β Never touching your global git config
npm install -g git-context# 1. Login to your account
lexa login
# 2. Create a git profile
lexa git setup my-personal-account
# 3. Clone a repo using your profile (no credential prompts!)
lexa clone https://github.com/user/repo.git -p my-personal-account
# 4. Or apply profile to an existing repo
cd ~/projects/my-personal-project
lexa git use my-personal-account
# That's it! Your repo now uses the correct identity.Track all your lexa actions with detailed logs.
View recent activity logs including actions, profiles used, and time.
# View recent logs
lexa logs
# View logs from last 2 days
lexa logs --days 2
# View last 10 entries
lexa logs --last 10
# Clear all logs
lexa logs --clearOutput:
Date/Time β Action β Profile β Details
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
01/01/26 20:15 IST β git use β om-ghante β Applied to /path/repo
01/01/26 20:10 IST β clone β om-ghante β github.com/user/repo
01/01/26 19:45 IST β init β work β /home/user/project
01/01/26 18:00 IST β login β - β omghante@gmail.com
You can simply type what you want to do in plain English!
lexa "init repo in /my/folder with github.com/user/repo"
lexa "clone github.com/user/repo using work"
lexa "list my profiles"
lexa "use personal profile here"Authenticate with your lexa account using email and password.
lexa loginOptions:
- Create a new account or login with existing account
- Email and password authentication via Firebase
Clear stored credentials and logout from the current session.
lexa logoutDisplay information about the currently logged-in user.
lexa whoamiOutput:
Current User
Email: yourname@email.com
User ID: abc123...
Session expires: 1/2/2026, 10:30:00 AM
Show overall status including authentication state and current git context.
lexa statusOutput:
lexa Status
[OK] Authenticated
Email: yourname@email.com
[OK] In git repository
Root: /home/user/projects/my-repo
Local config:
user.name = your-username
user.email = your@email.com
Active profile: personal
Clone a repository using stored credentials. No more credential prompts!
# Interactive: prompts you to select a profile
lexa clone https://github.com/user/repo.git
# Specify profile directly
lexa clone https://github.com/user/repo.git --profile my-work-account
lexa clone https://github.com/user/repo.git -p my-work-account
# Clone to a custom directory
lexa clone https://github.com/user/repo.git -d my-folder
# Combine options
lexa clone https://github.com/user/private-repo.git -p work -d project-folderOptions:
| Option | Alias | Description |
|---|---|---|
--profile <name> |
-p |
Profile to use for cloning |
--directory <path> |
-d |
Directory to clone into |
How it works:
- Fetches credentials from the selected profile
- Injects username:PAT into the clone URL
- Clones without asking for credentials
- Automatically applies the profile (user.name, user.email)
- Configures credential helper for future push/pull
Create a new git profile or update an existing one.
# Interactive mode
lexa git setup
# Create/update a specific profile
lexa git setup my-work-accountYou'll be prompted for:
| Field | Description |
|---|---|
| Profile Name | Unique identifier for this profile (e.g., work, personal) |
| Provider | GitHub, GitLab, Bitbucket, or Other |
| Username | Your git username |
| Email address for git commits | |
| Personal Access Token (PAT) | For HTTPS authentication (stored encrypted) |
| SSH Key Path | Optional path to SSH private key |
Example:
$ lexa git setup personal
Git Profile Setup
? Profile name: personal
? Git provider: GitHub
? Git username: john-doe
? Git email: john@email.com
? Personal Access Token (PAT): ********
? SSH private key path (optional):
[OK] Profile "personal" saved successfully!
To use this profile in a git repository:
lexa git use personalApply a git profile to the current repository.
cd ~/projects/my-repo
lexa git use personalWhat it does:
- Sets
git config --local user.nameanduser.email - Configures credential helper with your PAT
- Configures SSH key (if specified in profile)
- Saves profile info to
.gitcontext/folder
Example:
$ lexa git use personal
Apply Git Profile
Repository: /home/user/projects/my-repo
Fetching profile...
Applying configuration...
[OK] user.name = john-doe
[OK] user.email = john@email.com
[OK] HTTPS credentials configured for github.com
[OK] Saved to .gitcontext/
[OK] Profile "personal" applied successfully!
Provider: github
Username: john-doe
Email: john@email.com
[OK] Git push/pull will now use your stored credentials automatically!List all your saved git profiles.
lexa git list
# Alias:
lexa git lsExample:
$ lexa git list
Your Git Profiles
Fetching profiles...
Found 2 profile(s):
1. personal
Provider: github
Username: john-doe
Email: john@email.com
Token: ******** (stored)
Created: Dec 28, 2025, 11:04 PM
2. work
Provider: github
Username: john-work
Email: john@company.com
Token: ******** (stored)
Created: Dec 20, 2025, 04:43 PM
--------------------------------------------------
Commands:
Use a profile: lexa git use <name>
Update a profile: lexa git setup <name>
Remove a profile: lexa git remove <name>Delete a git profile permanently.
lexa git remove old-account
# Alias:
lexa git rm old-accountExample:
$ lexa git remove old-account
Remove Git Profile
? Are you sure you want to delete profile "old-account"? Yes
[OK] Profile "old-account" deleted successfully!-
Profiles stored in Firebase: Your profiles are stored securely in Firebase Firestore, so you can access them from any machine.
-
Local git config only: When you run
lexa git use, it setsgit config --localvalues, affecting only that repository. -
Credential-embedded cloning:
lexa cloneinjects your PAT into the clone URL (https://user:token@github.com/...), so Git never prompts for credentials. -
Encrypted tokens: PAT tokens are encrypted using AES-256-GCM before storage.
-
.gitcontext/folder: Each repo gets a.gitcontext/folder (auto-added to.gitignore) containing the active profile info.
For SSH authentication with multiple accounts:
-
Generate separate SSH keys:
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_personal -C "personal@email.com" ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_work -C "work@email.com"
-
Add the public keys to GitHub/GitLab
-
When creating profiles, specify the SSH key path:
lexa git setup personal # When prompted for SSH key, enter: ~/.ssh/id_ed25519_personal -
lexa git usewill configurecore.sshCommandfor that repo
- π No global git config changes - Only
--localconfiguration - π Encrypted token storage - AES-256-GCM with machine-derived keys
- π Firebase Auth - Secure authentication with ID tokens
- π Owner-only access - Firestore rules restrict profile access
- π Credentials not logged - PAT is masked in clone URLs during display
# First, set up a profile with your PAT
lexa git setup work
# Now clone any private repo
lexa clone https://github.com/company/private-repo.git -p work
# Done! No username/password prompts
cd private-repo
git pull # Works automatically!# Work on personal project
cd ~/personal/my-app
lexa git use personal
git commit -m "Personal commit"
git push # Uses personal credentials
# Switch to work project
cd ~/work/company-app
lexa git use work
git commit -m "Work commit"
git push # Uses work credentialslexa status
# Shows:
# β Authenticated (email@example.com)
# β In git repository
# Local config: user.name = your-username
# Active profile: personalRun lexa login to authenticate first.
The lexa git use command must be run inside a git repository. Use git init or clone a repo first.
Run lexa git list to see available profiles. Profile names are case-sensitive.
Make sure your profile has a PAT (Personal Access Token) stored. Update it with:
lexa git setup <profile-name>Contributions are welcome! Please feel free to submit a Pull Request.
Repository: https://github.com/om-ghante/git-context.npmpkg
MIT Β© Om Ghante