Never type your token again after cloning a repo.
git-login detects the current repository's remote provider, configures
git credential.helper cache globally, and feeds the right credentials into
it — so git push just works for the next hour.
- Auto-detects provider from
originremote (HTTPS or SSH URL) - Reads credentials from environment variables when available
- Falls back to an interactive prompt (token input is hidden) when not
- Credential cache lasts 3600 seconds — one run per session is enough
- Multi-provider: GitHub and GitLab out of the box, easy to extend
| Provider | Username variable | Token variable |
|---|---|---|
| GitHub | GITHUB_USER |
GITHUB_TOKEN |
| GitLab | GITLAB_USER |
GITLAB_TOKEN |
# inside any cloned repo
git-loginIf the variables are set, it runs silently. Otherwise it prompts:
GitHub username: your-username
GitHub token: ········
git-login: GitHub credentials cached (your-username@github.com, timeout 3600s)
Export the variables in your shell profile (~/.bashrc, ~/.zshrc, etc.):
export GITHUB_USER=your-username
export GITHUB_TOKEN=ghp_...Then git-login becomes a zero-input command you can run right after git clone.
Requires mush.
mush build # → target/debug/git-login
mush build --release # → target/release/git-login- Create
src/<provider>.shwith agit_login_<provider>_login()function (copysrc/github.shas a template). - Add
module <provider>at the top ofsrc/main.sh. - Add a
<provider>)case in thecase "$provider" inblock ofmain(). - Add the host pattern in
git_login_provider_detect()insidesrc/provider.sh.