gh secret set

Create or update secrets

Synopsis

Locally encrypt a new or updated secret at either the repository, environment, or organization level and send it to GitHub for storage.

gh secret set <secret-name> [flags]

Examples

Paste secret in prompt
$ gh secret set MYSECRET

Use environment variable as secret value
$ gh secret set MYSECRET  -b"${ENV_VALUE}"

Use file as secret value
$ gh secret set MYSECRET < file.json

Set environment level secret
$ gh secret set MYSECRET -bval --env=anEnv

Set organization level secret visible to entire organization
$ gh secret set MYSECRET -bval --org=anOrg --visibility=all

Set organization level secret visible only to certain repositories
$ gh secret set MYSECRET -bval --org=anOrg --repos="repo1,repo2,repo3"

Options

  -b, --body string      A value for the secret. Reads from STDIN if not specified.
  -e, --env string       Set a secret for an environment
  -o, --org string       Set a secret for an organization
  -r, --repos selected   List of repository names for selected visibility
  -v, --visibility all   Set visibility for an organization secret: all, `private`, or `selected` (default "private")

Options inherited from parent commands

      --help                     Show help for command
  -R, --repo [HOST/]OWNER/REPO   Select another repository using the [HOST/]OWNER/REPO format