rt git auth
rt › git › auth
Let git sign in with rt's forge token
Usage
rt git auth [<path>] [flags]
Arguments & flags
| Flag / Arg | Type | Default | Description |
|---|---|---|---|
<path> | text | The clone to set up | |
--https | boolean | false | Switch an SSH clone to HTTPS too |
--check | boolean | false | Show which clones use rt's token |
--yes | boolean | false | Skip the confirm |
--json | boolean | false | Print JSON |
See code: commands/git/auth.ts › authCommand
Examples & notes
Lets a clone's git sign in with the forge token rt already holds, so you stop juggling a second login.
# See which registered clones use rt's token
rt git auth --check
# Set up the clone you are in
rt git auth
# Set up another clone
rt git auth ~/Documents/GitHub/widgets
# Switch an SSH clone to HTTPS, then set it up
rt git auth --https
rt asks before it changes anything. At a terminal it shows the plan and waits for a yes. With no terminal, pass --yes, or rt refuses and prints the command to run (--json returns the needs-consent code instead). rt changes only the clone you name, never your global git config.
What it writes. Two local config values for credential.https://<host>.helper: an empty value, then rt's helper. The empty value makes git skip its other helpers, like the keychain, for that host in this clone. git hands a token to every helper after the empty value, so rt's pair must be the last helper for the host: when a helper in the clone's own config comes after it, or would, rt refuses and does not add its helper. Under --https, if rt only finds this after switching origin, origin stays on HTTPS, and rt says so and prints origin's undo. rt's token is never written to config, a URL or a log.
--https. Switches an SSH origin to HTTPS, and a push URL that pointed at the same repo, then writes the two values if they are not there yet. Without it, rt leaves an SSH clone alone and names the command that would switch it.
--check. Lists every registered clone and changes nothing:
| State | Meaning |
|---|---|
done | The clone already uses rt's token |
pending | HTTPS clone on its own git credentials. Run rt git auth |
off | SSH clone. Run rt git auth --https |
skipped | rt left it alone, and the row says why, such as its own credential helper, a helper that comes after rt's, or a host rt has no token for |
With --json, a clone rt could not read has "transport": null and "host": null.
Undo. rt prints the commands that reverse the change, in the form git -C <path> config --unset-all ... and git -C <path> remote set-url .... When the old origin URL held credentials, rt leaves out its undo rather than print them.
When rt passes its token to glab, it forces HTTPS, even if your glab config sets api_protocol: http for that host.