init

Sets up Git Wrangler’s GitHub and AI credentials.

Usage

git-wrangler init

What it does

Prompts for the GitHub host, starts GitHub device OAuth, stores the GitHub token in the system keyring, and saves the authenticated username in non-secret config. It prints the one-time code and verification URL before waiting, attempts to open the URL in the platform browser, and continues on browserless machines so authorization can be completed elsewhere.

It also prompts for AI provider settings and can store the AI API key in the system keyring.

Secrets are never written to the JSON config file.

Use init before:

  • clone --visibility private or clone --visibility all
  • rename-repo
  • commit
  • rewrite-commits

GitHub authentication and AI API key storage are optional prompts. Host, provider, base URL, and model settings are saved to the non-secret config file.

If secure keyring storage is unavailable, init skips GitHub OAuth and AI API-key entry, saves the non-secret settings, warns without exposing backend keyring errors, and exits successfully. Configure credentials with environment variables on those machines.

Press Ctrl+C or Ctrl+D during an active prompt to cancel immediately. Cancellation stops setup and exits nonzero.

Environment overrides

GitHub auth can come from GIT_WRANGLER_GITHUB_TOKEN. An inbound GH_TOKEN is ignored; Git Wrangler uses GH_TOKEN only when passing its resolved credential to child gh processes.

AI auth can come from GIT_WRANGLER_AI_API_KEY. For the openai provider, OPENAI_API_KEY is also accepted.