.nh .TH "GH-VARIABLE-SET" "1" "May 2024" "" "GitHub CLI manual" .SH NAME .PP gh-variable-set - Create or update variables .SH SYNOPSIS .PP \fBgh variable set [flags]\fR .SH DESCRIPTION .PP Set a value for a variable on one of the following levels: - repository (default): available to GitHub Actions runs or Dependabot in a repository - environment: available to GitHub Actions runs for a deployment environment in a repository - organization: available to GitHub Actions runs or Dependabot within an organization .PP Organization variable can optionally be restricted to only be available to specific repositories. .SH OPTIONS .TP \fB-b\fR, \fB--body\fR \fB\fR The value for the variable (reads from standard input if not specified) .TP \fB-e\fR, \fB--env\fR \fB\fR Set deployment environment variable .TP \fB-f\fR, \fB--env-file\fR \fB\fR Load variable names and values from a dotenv-formatted file .TP \fB-o\fR, \fB--org\fR \fB\fR Set organization variable .TP \fB-r\fR, \fB--repos\fR \fB\fR List of repositories that can access an organization variable .TP \fB-v\fR, \fB--visibility\fR \fB (default "private")\fR Set visibility for an organization variable: {all|private|selected} .SH OPTIONS INHERITED FROM PARENT COMMANDS .TP \fB-R\fR, \fB--repo\fR \fB<[HOST/]OWNER/REPO>\fR Select another repository using the [HOST/]OWNER/REPO format .SH EXAMPLE .EX # Add variable value for the current repository in an interactive prompt $ gh variable set MYVARIABLE # Read variable value from an environment variable $ gh variable set MYVARIABLE --body "$ENV_VALUE" # Read variable value from a file $ gh variable set MYVARIABLE < myfile.txt # Set variable for a deployment environment in the current repository $ gh variable set MYVARIABLE --env myenvironment # Set organization-level variable visible to both public and private repositories $ gh variable set MYVARIABLE --org myOrg --visibility all # Set organization-level variable visible to specific repositories $ gh variable set MYVARIABLE --org myOrg --repos repo1,repo2,repo3 # Set multiple variables imported from the ".env" file $ gh variable set -f .env .EE .SH SEE ALSO .PP \fBgh-variable(1)\fR