Skip to content

Managing Credentials

Manage your iOS and Android build credentials locally for convenient cloud builds.

Capgo CLI stores your build credentials on your machine — never on Capgo’s servers. By default they live in one global file, ~/.capgo-credentials/credentials.json, shared across all your projects. Pass --local to keep them per-project in .capgo-credentials.json instead. When you run a build, the saved credentials are used automatically and sent securely to Capgo, then deleted after the build completes.

The quickest way to work with your saved credentials is the interactive manager. It opens a TUI (the same one build init uses) where you can browse what’s stored, see what’s configured per app and platform, export a CI/CD-ready .env file, or delete a platform’s credentials:

Terminal window
bunx @capgo/cli@latest build credentials manage
OptionDescription
--appId <appId>App to manage (prompts you to pick if omitted)
--platform <ios|android>Platform to manage (prompts if omitted)
--localUse the per-project .capgo-credentials.json instead of the global file

Prefer one-shot, scriptable commands? Use the individual commands below.

Store your build credentials locally for automatic use:

Terminal window
bunx @capgo/cli@latest build credentials save --platform <ios|android> [options]

Partially update existing credentials without re-providing everything:

Terminal window
bunx @capgo/cli@latest build credentials update --platform <ios|android> [options]

The update command uses additive merge for provisioning profiles — new profiles are merged with existing ones. To replace the entire provisioning map instead, add --overwrite-ios-provisioning-map.

Example — add an extension profile to existing credentials:

Terminal window
bunx @capgo/cli@latest build credentials update \
--platform ios \
--ios-provisioning-profile "com.example.app.widget=./widget_profile.mobileprovision"

The update command accepts the same options as save but all are optional — only the fields you provide are updated.

View currently saved credentials (passwords are masked):

Terminal window
bunx @capgo/cli@latest build credentials list
# List credentials for a specific app
bunx @capgo/cli@latest build credentials list --appId com.example.app

Remove saved credentials from your local machine:

Terminal window
# Clear all credentials
bunx @capgo/cli@latest build credentials clear
# Clear credentials for a specific app + platform
bunx @capgo/cli@latest build credentials clear --appId com.example.app --platform ios

Convert legacy single-profile format to the new multi-target format:

Terminal window
bunx @capgo/cli@latest build credentials migrate --platform ios

The migrate command detects old BUILD_PROVISION_PROFILE_BASE64 credentials, converts them to CAPGO_IOS_PROVISIONING_MAP, and removes the legacy keys. See Migration from Single Profile for details.

Terminal window
bunx @capgo/cli@latest build credentials save \
--platform ios \
--certificate ./cert.p12 \
--p12-password "YourP12Password" \
--ios-provisioning-profile "com.example.app=./profile.mobileprovision" \
--apple-key ./AuthKey_ABC1234567.p8 \
--apple-key-id "ABC1234567" \
--apple-issuer-id "00000000-0000-0000-0000-000000000000" \
--apple-team-id "TEAM123456"
OptionDescriptionRequired
--certificate <path>Path to .p12 certificate fileYes (release)
--p12-password <password>Password for the .p12 certificateYes (release)
--ios-provisioning-profile <mapping>Provisioning profile mapping (bundleId=path). Repeatable for multi-target apps. If only one profile and no bundleId prefix, CLI auto-infers from the profile.Yes (release)
--apple-key <path>Path to App Store Connect API .p8 keySee note¹
--apple-key-id <id>App Store Connect API Key IDSee note¹
--apple-issuer-id <id>App Store Connect API Issuer ID (UUID)See note¹
--apple-team-id <id>App Store Connect Team IDYes
--ios-distribution <mode>Distribution mode: app_store (default) or ad_hocNo
--output-uploadEnable a time-limited Capgo download link for the build artifactNo (default: false)
--output-retention <seconds>How long to keep build outputs (e.g. 3600s)No (default: 3600s)
--skip-build-number-bumpSkip automatic build-number incrementNo

When you save iOS credentials, the CLI:

  1. Reads the certificate and provisioning profile files
  2. Converts them to base64 encoding
  3. Saves them to ~/.capgo-credentials/credentials.json (or .capgo-credentials.json with --local)
  4. Stores passwords and IDs as plain text (local files only)

The stored file structure:

{
"ios": {
"BUILD_CERTIFICATE_BASE64": "...",
"CAPGO_IOS_PROVISIONING_MAP": "{\"com.example.app\":{\"profile\":\"...\",\"name\":\"match AppStore com.example.app\"}}",
"APPLE_KEY_CONTENT": "...",
"P12_PASSWORD": "...",
"APPLE_KEY_ID": "ABC1234567",
"APPLE_ISSUER_ID": "...",
"APP_STORE_CONNECT_TEAM_ID": "TEAM123456",
"CAPGO_IOS_DISTRIBUTION": "app_store"
}
}
Terminal window
bunx @capgo/cli@latest build credentials save \
--platform android \
--keystore ./release.keystore \
--keystore-alias "my-key-alias" \
--keystore-key-password "KeyPassword123" \
--keystore-store-password "StorePassword123" \
--play-config ./play-store-service-account.json
OptionDescriptionRequired
--keystore <path>Path to .keystore or .jks fileYes (release)
--keystore-alias <alias>Key alias in the keystoreYes (release)
--keystore-key-password <password>Password for the key aliasYes (release)
--keystore-store-password <password>Password for the keystoreYes (release)
--play-config <path>Path to Play Store service account JSONYes (submission)

When you save Android credentials, the CLI:

  1. Reads the keystore and service account JSON files
  2. Converts them to base64 encoding
  3. Saves them to ~/.capgo-credentials/credentials.json (or .capgo-credentials.json with --local)
  4. Stores passwords and alias as plain text (local files only)

The stored file structure:

{
"android": {
"ANDROID_KEYSTORE_FILE": "...",
"PLAY_CONFIG_JSON": "...",
"KEYSTORE_KEY_ALIAS": "my-key-alias",
"KEYSTORE_KEY_PASSWORD": "...",
"KEYSTORE_STORE_PASSWORD": "..."
}
}

Once you’ve saved credentials, they’re automatically used when you build:

Terminal window
# Credentials automatically loaded from ~/.capgo-credentials/credentials.json
bunx @capgo/cli@latest build request com.example.app --platform ios

You can also override saved credentials using environment variables:

Terminal window
# Environment variables take precedence over saved credentials
BUILD_CERTIFICATE_BASE64="..." \
P12_PASSWORD="different-password" \
bunx @capgo/cli@latest build request com.example.app --platform ios

Precedence order:

  1. Environment variables (highest priority)
  2. Saved credentials (~/.capgo-credentials/credentials.json, or local .capgo-credentials.json)
  3. No credentials (lowest priority)

List what credentials you have saved:

Terminal window
bunx @capgo/cli@latest build credentials list

Example output:

📋 Saved Build Credentials:
iOS Credentials:
✓ Certificate (base64)
✓ Provisioning Map (JSON)
✓ Apple Key Content (base64)
✓ P12 Password: ********
✓ Apple Key ID: ABC1234567
✓ Apple Issuer ID: 00000000-0000-0000-0000-000000000000
✓ Team ID: TEAM123456
Android Credentials:
✓ Keystore (base64)
✓ Play Store Config (base64)
✓ Keystore Alias: my-key-alias
✓ Key Password: ********
✓ Store Password: ********
Location: ~/.capgo-credentials/credentials.json
🔒 These credentials are stored locally on your machine only.
When building, they are sent to Capgo but NEVER stored there.
They are auto-deleted after build completion.
  1. File Permissions

    Terminal window
    # Global credentials directory + file
    chmod 700 ~/.capgo-credentials
    chmod 600 ~/.capgo-credentials/credentials.json
    # Local (per-project) credentials, if you use --local
    chmod 600 .capgo-credentials.json
  2. Never Commit Credentials

    Terminal window
    # Ignore the per-project credentials file (used with --local)
    echo ".capgo-credentials.json" >> .gitignore

    The global file lives in your home directory, outside the repo.

  3. Separate Credentials

    • Use different credentials for local development vs CI/CD
    • Rotate credentials regularly
    • Don’t share credentials between team members

For CI/CD environments, prefer environment variables over saved credentials.

Instead of base64-encoding each credential file by hand (see below), let build credentials manage generate the file for you:

Terminal window
bunx @capgo/cli@latest build credentials manage
# pick your app → choose "Export to .env"

It writes a .env.capgo.<appId>.<platform> file (permissions 0600) containing every saved credential as an environment variable — each line is one secret to add to your CI/CD provider. Both platforms are combined by default; add --platform ios or --platform android to scope it to one.

The CLI reads the following environment variables for credentials:

iOS Credentials:

VariableDescriptionFormatRequired
BUILD_CERTIFICATE_BASE64P12/PKCS12 certificate for code signingBase64Yes (release)
CAPGO_IOS_PROVISIONING_MAPJSON map of bundle IDs to provisioning profile dataJSON stringYes (release)
P12_PASSWORDPassword for the P12 certificatePlain textOptional
APPLE_KEY_IDApp Store Connect API Key IDString (e.g., “ABC1234567”)See note¹
APPLE_ISSUER_IDApp Store Connect API Issuer IDUUID stringSee note¹
APPLE_KEY_CONTENTApp Store Connect API key (.p8 file content)Base64See note¹
APP_STORE_CONNECT_TEAM_IDApple Developer Team IDString (e.g., “XXXXXXXXXX”)Yes
CAPGO_IOS_DISTRIBUTIONDistribution mode: app_store (default) or ad_hocStringNo

Android Credentials:

VariableDescriptionFormatRequired
ANDROID_KEYSTORE_FILEKeystore file for signing APK/AABBase64Yes (release)
KEYSTORE_KEY_ALIASKey alias within the keystoreStringYes (release)
KEYSTORE_KEY_PASSWORDPassword for the key aliasPlain textYes*
KEYSTORE_STORE_PASSWORDPassword for the keystore filePlain textYes*
PLAY_CONFIG_JSONGoogle Play service account JSONBase64Yes (submission)

*If only one password is provided, it will be used for both KEYSTORE_KEY_PASSWORD and KEYSTORE_STORE_PASSWORD.

.github/workflows/build.yml
name: Cloud Build
on:
push:
branches: [main]
jobs:
build-ios:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bunx @capgo/cli@latest build request com.example.app --platform ios
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
CAPGO_IOS_PROVISIONING_MAP: ${{ secrets.CAPGO_IOS_PROVISIONING_MAP }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }}
APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }}
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bunx @capgo/cli@latest build request com.example.app --platform android
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE_FILE }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
PLAY_CONFIG_JSON: ${{ secrets.PLAY_CONFIG_JSON }}

To convert your credential files to base64 for CI/CD secrets:

Terminal window
# iOS Certificate (.p12)
base64 -i certificate.p12 | tr -d '\n' > certificate_base64.txt
# iOS Provisioning Profiles — use the CLI to generate CAPGO_IOS_PROVISIONING_MAP:
bunx @capgo/cli@latest build credentials save --platform ios \
--ios-provisioning-profile "com.example.app=./profile.mobileprovision" \
# ... other options
# Then copy CAPGO_IOS_PROVISIONING_MAP from ~/.capgo-credentials/credentials.json to your CI secrets
# iOS App Store Connect Key (.p8)
base64 -i AuthKey_XXXXXX.p8 | tr -d '\n' > apple_key_base64.txt
# Android Keystore (.keystore or .jks)
base64 -i release.keystore | tr -d '\n' > keystore_base64.txt
# Google Play Service Account JSON
base64 -i play-store-service-account.json | tr -d '\n' > play_config_base64.txt

This approach is more secure because:

  • Secrets are managed by your CI/CD platform
  • No credential files on runners
  • Easy rotation and access control
  • Audit trails for secret usage

Regularly rotate your credentials:

  1. iOS: Generate new certificates and API keys yearly
  2. Android: Change keystore passwords annually
  3. After team changes: Rotate when team members leave

Update saved credentials:

Terminal window
# Re-run save command with new credentials
bunx @capgo/cli@latest build credentials save --platform ios --certificate ./new-cert.p12 ...

If the build says no credentials were found:

  1. Check if credentials are saved:

    Terminal window
    bunx @capgo/cli@latest build credentials list
  2. Save credentials if missing:

    Terminal window
    bunx @capgo/cli@latest build credentials save --platform ios ...
  3. Verify the credentials file exists:

    Terminal window
    ls -la ~/.capgo-credentials/credentials.json # global
    ls -la .capgo-credentials.json # local (--local)

“Permission denied” when reading credentials

Section titled ““Permission denied” when reading credentials”

Fix file permissions:

Terminal window
chmod 600 ~/.capgo-credentials/credentials.json # global
chmod 600 .capgo-credentials.json # local

Check that the correct platform is specified:

Terminal window
# Make sure --platform matches saved credentials
bunx @capgo/cli@latest build request com.example.app --platform ios # Uses ios credentials
bunx @capgo/cli@latest build request com.example.app --platform android # Uses android credentials

If credentials seem corrupted:

Terminal window
# Clear all credentials
bunx @capgo/cli@latest build credentials clear
# Save again
bunx @capgo/cli@latest build credentials save --platform ios ...

If you’re currently using environment variables, you can migrate to saved credentials:

  1. Extract your current environment variables

    Terminal window
    echo $BUILD_CERTIFICATE_BASE64 # Verify they exist
  2. Decode base64 files back to original files (if needed)

    Terminal window
    echo "$BUILD_CERTIFICATE_BASE64" | base64 -d > cert.p12
    echo "$BUILD_PROVISION_PROFILE_BASE64" | base64 -d > profile.mobileprovision
  3. Save using the CLI

    Terminal window
    bunx @capgo/cli@latest build credentials save \
    --platform ios \
    --certificate ./cert.p12 \
    --ios-provisioning-profile ./profile.mobileprovision \
    --p12-password "$P12_PASSWORD" \
    --apple-key-id "$APPLE_KEY_ID" \
    --apple-issuer-id "$APPLE_ISSUER_ID" \
    --apple-team-id "$APP_STORE_CONNECT_TEAM_ID"

    If you have existing credentials saved in the old format (single BUILD_PROVISION_PROFILE_BASE64), run:

    Terminal window
    bunx @capgo/cli@latest build credentials migrate --platform ios

    This converts the legacy single-profile to a CAPGO_IOS_PROVISIONING_MAP and removes the old BUILD_PROVISION_PROFILE_BASE64 and APPLE_PROFILE_NAME keys.

  4. Test the build

    Terminal window
    bunx @capgo/cli@latest build request com.example.app --platform ios
  5. Remove environment variables (optional)

    Terminal window
    unset BUILD_CERTIFICATE_BASE64 BUILD_PROVISION_PROFILE_BASE64

Credentials are stored in a single JSON file:

  • Global (default): ~/.capgo-credentials/credentials.json — shared across all your projects
  • Local (with --local): .capgo-credentials.json in your project root — overrides the global file for that project

The file is created automatically the first time you save credentials. Add .capgo-credentials.json to your .gitignore so per-project credentials are never committed.

If you are using Managing Credentials to plan CI/CD automation, connect it with Capgo CI/CD for the product workflow in Capgo CI/CD, Capgo Native Builds for the product workflow in Capgo Native Builds, Capgo Integrations for the product workflow in Capgo Integrations, CI/CD Integration for the implementation detail in CI/CD Integration, and GitHub Actions Integration for the implementation detail in GitHub Actions Integration.