Skip to main content

CLI Commands Reference

Complete reference for all Keyway CLI commands.

Global options

These options work with all commands:

OptionDescription
--help, -hShow help
--version, -VShow version
--no-login-promptFail instead of prompting to login if unauthenticated (useful for CI/CD)

keyway login

Authenticate with Keyway using GitHub OAuth.

keyway login [options]

Options:

OptionDescription
--tokenAuthenticate using a GitHub fine-grained PAT instead of OAuth

Opens a browser for GitHub authentication. After approval, your token is stored locally.

Using a Personal Access Token:

keyway login --token
# You will be prompted to enter your GitHub fine-grained PAT

Stored in: ~/.config/keyway/config.json


keyway logout

Clear stored authentication.

keyway logout

Removes the locally stored token.


keyway init

Initialize a vault for the current repository.

keyway init

Requirements:

  • Admin access on the GitHub repository
  • Git repository with GitHub remote (auto-detected)

Example:

cd my-project
keyway init
# Output: Vault created for owner/my-project

keyway push

Push local secrets to Keyway.

keyway push [options]

Options:

OptionDefaultDescription
-e, --env <name>developmentTarget environment
-f, --file <path>.envSource file path
-y, --yesfalseSkip confirmation

Behavior:

  • Syncs the entire environment
  • Secrets not in the file are removed from the environment
  • Creates new secrets, updates existing ones

Example:

# Push to development environment (default)
keyway push

# Push to production
keyway push -e production

# Push from custom file
keyway push -f .env.production -e production

keyway pull

Pull secrets from Keyway to local file.

keyway pull [options]

Options:

OptionDefaultDescription
-e, --env <name>developmentSource environment
-f, --file <path>.envOutput file path
-y, --yesfalseSkip confirmation (overwrite)

Example:

# Pull development environment (default)
keyway pull

# Pull staging to custom file
keyway pull -e staging -f .env.staging

keyway doctor

Run diagnostic checks.

keyway doctor [options]

Options:

OptionDefaultDescription
--jsonfalseOutput results as JSON for machine processing
--strictfalseTreat warnings as failures

Checks performed:

  1. Authentication - Is the user logged in?
  2. Token validity - Is the token still valid?
  3. Git repository - Is this a git repo?
  4. GitHub remote - Is there a GitHub remote?
  5. Vault existence - Does a vault exist for this repo?
  6. Permissions - What access level does the user have?
  7. Network - Can we reach the Keyway API?

Example output:

Keyway Doctor
=============

✓ Authenticated as octocat
✓ Token valid (expires in 29 days)
✓ Git repository detected
✓ GitHub remote: owner/repo
✓ Vault exists
✓ Permission level: admin
✓ API reachable

All checks passed!

keyway connect

Connect to an external provider for secret syncing.

keyway connect <provider>

Supported providers:

  • vercel - Vercel deployment platform

Example:

keyway connect vercel
# Opens browser to authorize Keyway with Vercel

After connecting, you can use keyway sync to push secrets to the provider.


keyway connections

List your connected providers.

keyway connections

Example output:

Connected providers:
- vercel (connected on 2025-01-15)

keyway disconnect

Disconnect from a provider.

keyway disconnect <provider>

Example:

keyway disconnect vercel

keyway sync

Sync secrets between Keyway and a provider.

keyway sync <provider> [options]

Options:

OptionDefaultDescription
-e, --environment <env>productionKeyway environment to sync from
--provider-env <env>productionProvider environment to sync to
--project <project>-Provider project name or ID
--pullfalseImport secrets from provider to Keyway (reverse sync)
--allow-deletefalseAllow deleting secrets not present in source
-y, --yesfalseSkip confirmation prompt

Example:

# Sync production secrets to Vercel
keyway sync vercel

# Sync staging environment to Vercel preview
keyway sync vercel -e staging --provider-env preview

# Sync to a specific Vercel project
keyway sync vercel --project my-app

# Import secrets from Vercel into Keyway
keyway sync vercel --pull

# Sync and delete secrets not in Keyway
keyway sync vercel --allow-delete -y

Environment variables

VariableDescription
KEYWAY_TOKENAuthentication token (overrides stored token)
KEYWAY_API_URLAPI URL (default: https://api.keyway.sh)
KEYWAY_DISABLE_TELEMETRYSet to 1 to disable anonymous usage analytics

Example:

# Use a specific token
KEYWAY_TOKEN=ghp_xxx keyway pull

# Use a different API endpoint
KEYWAY_API_URL=https://api.staging.keyway.sh keyway pull

Exit codes

CodeMeaning
0Success
1General error
2Authentication required
3Vault not found
4Permission denied
5Network error