See who grim acts as
$ grim auth:whoami
A private module refuses to clone, or you have sat down at a machine someone else set up. Before anything else you want to know whether grim holds a token here, and whose. grim auth:whoami answers that and changes nothing.
Usage
$ grim auth:whoami # who, and which token
$ grim auth:whoami || grim auth:login # log in only when nothing is storedIt runs from anywhere. The exit code is 0 with a token and 1 without, so a script can test it.
Arguments and options
Show current authenticated user
Usage
grim auth:whoamiWhat it actually does
- Reads
~/.grim/config.json. Nothing else. GitHub is not contacted. - Prints one line.
Authenticated as anna (token: ghp_****abcd): the stored user name, then the first four and the last four characters of the token.
With no token it prints Not authenticated. Run `grim auth:login` first. and exits with 1.
Pitfalls
A stored token is not a working token
An expired or revoked token still reads as authenticated, because the check is local. When GitHub answers 401 in another command, run grim auth:login again. That one validates the token against GitHub.
An environment token hides the stored one
With GRIM_GITHUB_TOKEN exported, the masked token you see is the one from the environment, while the user name still comes from the file. The two may not belong together. Unset the variable to see what is stored.
After it finishes
Nothing has changed. If the name is not yours, log in again and the stored token is replaced.
Related spells
grim auth:login
Log grim in to GitHub
Give grim a GitHub token, from your gh login or a personal access token, and hand the same token to Composer and Docker.
grim doctor
Check your circle
Check every tool grim expects on this machine, and the project you are standing in, and say what to do about what is missing.
grim config
Read and write CLI settings
Read, set and remove the per-user settings grim keeps in ~/.grim/config.json.