.nh .TH "GH-SECRET-SET" "1" "Oct 2022" "" "GitHub CLI manual" .SH NAME .PP gh-secret-set - Create or update secrets .SH SYNOPSIS .PP \fB\fCgh secret set [flags]\fR .SH DESCRIPTION .PP Set a value for a secret on one of the following levels: - repository (default): available to Actions runs or Dependabot in a repository - environment: available to Actions runs for a deployment environment in a repository - organization: available to Actions runs, Dependabot, or Codespaces within an organization - user: available to Codespaces for your user .PP Organization and user secrets can optionally be restricted to only be available to specific repositories. .PP Secret values are locally encrypted before being sent to GitHub. .SH OPTIONS .TP \fB\fC-a\fR, \fB\fC--app\fR \fB\fC\fR Set the application for a secret: {actions|codespaces|dependabot} .TP \fB\fC-b\fR, \fB\fC--body\fR \fB\fC\fR The value for the secret (reads from standard input if not specified) .TP \fB\fC-e\fR, \fB\fC--env\fR \fB\fC\fR Set deployment environment secret .TP \fB\fC-f\fR, \fB\fC--env-file\fR \fB\fC\fR Load secret names and values from a dotenv-formatted file .TP \fB\fC--no-store\fR Print the encrypted, base64-encoded value instead of storing it on Github .TP \fB\fC-o\fR, \fB\fC--org\fR \fB\fC\fR Set organization secret .TP \fB\fC-r\fR, \fB\fC--repos\fR \fB\fC\fR List of repositories that can access an organization or user secret .TP \fB\fC-u\fR, \fB\fC--user\fR Set a secret for your user .TP \fB\fC-v\fR, \fB\fC--visibility\fR \fB\fC\fR Set visibility for an organization secret: {all|private|selected} .SH OPTIONS INHERITED FROM PARENT COMMANDS .TP \fB\fC-R\fR, \fB\fC--repo\fR \fB\fC<[HOST/]OWNER/REPO>\fR Select another repository using the [HOST/]OWNER/REPO format .SH EXAMPLE .PP .RS .nf # Paste secret value for the current repository in an interactive prompt $ gh secret set MYSECRET # Read secret value from an environment variable $ gh secret set MYSECRET --body "$ENV_VALUE" # Read secret value from a file $ gh secret set MYSECRET < myfile.txt # Set secret for a deployment environment in the current repository $ gh secret set MYSECRET --env myenvironment # Set organization-level secret visible to both public and private repositories $ gh secret set MYSECRET --org myOrg --visibility all # Set organization-level secret visible to specific repositories $ gh secret set MYSECRET --org myOrg --repos repo1,repo2,repo3 # Set user-level secret for Codespaces $ gh secret set MYSECRET --user # Set repository-level secret for Dependabot $ gh secret set MYSECRET --app dependabot # Set multiple secrets imported from the ".env" file $ gh secret set -f .env .fi .RE .SH SEE ALSO .PP \fB\fCgh-secret(1)\fR