Skip to main content
CI environments, SSH sessions, and containers may not be able to open a browser for OAuth. Use an API token for automation. For an interactive SSH session, print the sign-in URL and forward the local callback port from the browser machine. An API token lets you authenticate without any browser interaction. The token is read from an environment variable, so you can inject it as a CI secret without modifying your code or config files.
1

Get your API token

Log in to githits.com and navigate to your account settings. Copy your API token — it starts with ghi-.
2

Set the environment variable

Export the token in your shell or add it to your CI configuration as a secret:
3

Verify authentication

Confirm that GitHits picks up the token:
The output should show you as authenticated and indicate that credentials are sourced from the environment variable.

GitHub Actions example

Add your API token as a repository secret named GITHITS_API_TOKEN, then reference it in your workflow:
The same pattern works for GitLab CI (variables:), CircleCI (project environment variables), and any other CI system that supports injecting secrets as environment variables.

Option 2: OAuth over an SSH tunnel

If the CLI runs on a remote host but your browser runs locally, choose a fixed callback port on the remote host:
Remote host
From the browser machine, forward the same port to the remote loopback listener:
Browser machine
Keep the tunnel open, then open the sign-in URL printed by the remote CLI. Replace user@remote-host with your SSH destination.

Option 3: File storage OAuth (scripted environments)

If you need OAuth credentials persisted for a scripted environment that runs repeatedly, you can store them in a file instead of the system keychain:
Subsequent runs in that environment read credentials from the file without any browser or keychain interaction.
File storage is not encrypted. The OAuth credentials are written as plain JSON files under your GitHits config directory. Any process that can read files as your OS user can read the tokens. For CI and automation, prefer GITHITS_API_TOKEN — it is easier to rotate and does not leave unencrypted credential files on disk.
You can also set file storage permanently in your config:

Choosing the right approach