1GH-SECRET-SET(1)               GitHub CLI manual              GH-SECRET-SET(1)
2
3
4

NAME

6       gh-secret-set - Create or update secrets
7
8
9

SYNOPSIS

11       gh secret set <secret-name> [flags]
12
13
14

DESCRIPTION

16       Set  a  value for a secret on one of the following levels: - repository
17       (default): available to Actions runs or Dependabot in  a  repository  -
18       environment:  available to Actions runs for a deployment environment in
19       a repository - organization: available to Actions runs, Dependabot,  or
20       Codespaces  within  an organization - user: available to Codespaces for
21       your user
22
23
24       Organization and user secrets can optionally be restricted to  only  be
25       available to specific repositories.
26
27
28       Secret values are locally encrypted before being sent to GitHub.
29
30
31

OPTIONS

33       -a, --app <string>
34              Set  the  application  for a secret: {actions|codespaces|depend‐
35              abot}
36
37
38       -b, --body <string>
39              The value for the secret (reads from standard input if not spec‐
40              ified)
41
42
43       -e, --env <environment>
44              Set deployment environment secret
45
46
47       -f, --env-file <file>
48              Load secret names and values from a dotenv-formatted file
49
50
51       --no-store
52              Print  the encrypted, base64-encoded value instead of storing it
53              on Github
54
55
56       -o, --org <organization>
57              Set organization secret
58
59
60       -r, --repos <repositories>
61              List of repositories that can access an organization or user se‐
62              cret
63
64
65       -u, --user
66              Set a secret for your user
67
68
69       -v, --visibility <string>
70              Set  visibility  for  an  organization  secret: {all|private|se‐
71              lected}
72
73
74

OPTIONS INHERITED FROM PARENT COMMANDS

76       -R, --repo <[HOST/]OWNER/REPO>
77              Select another repository using the [HOST/]OWNER/REPO format
78
79
80

EXAMPLE

82       # Paste secret value for the current repository in an interactive prompt
83       $ gh secret set MYSECRET
84
85       # Read secret value from an environment variable
86       $ gh secret set MYSECRET --body "$ENV_VALUE"
87
88       # Read secret value from a file
89       $ gh secret set MYSECRET < myfile.txt
90
91       # Set secret for a deployment environment in the current repository
92       $ gh secret set MYSECRET --env myenvironment
93
94       # Set organization-level secret visible to both public and private repositories
95       $ gh secret set MYSECRET --org myOrg --visibility all
96
97       # Set organization-level secret visible to specific repositories
98       $ gh secret set MYSECRET --org myOrg --repos repo1,repo2,repo3
99
100       # Set user-level secret for Codespaces
101       $ gh secret set MYSECRET --user
102
103       # Set repository-level secret for Dependabot
104       $ gh secret set MYSECRET --app dependabot
105
106       # Set multiple secrets imported from the ".env" file
107       $ gh secret set -f .env
108
109       # Set multiple secrets from stdin
110       $ gh secret set -f - < myfile.txt
111
112
113
114
115

SEE ALSO

117       gh-secret(1)
118
119
120
121                                   Nov 2023                   GH-SECRET-SET(1)
Impressum