← 返回命令列表

Linux command

gh-secret-set 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Set secret interactively

gh secret set [SECRET_NAME]

Set secret from value

echo "[value]" | gh secret set [SECRET_NAME]

Set from file

gh secret set [SECRET_NAME] < [secret.txt]

Set environment secret

gh secret set [SECRET_NAME] --env [production]

Set with body flag

gh secret set [SECRET_NAME] --body "[value]"

说明

gh secret set creates or updates encrypted secrets for GitHub Actions. When run interactively, it prompts for the secret value securely without echoing to the terminal. The command encrypts secrets using repository or organization public keys before transmission. Secrets can be scoped to specific environments for deployment workflows or to selected repositories in organizations. Pipe or redirect input to avoid exposing secrets in shell history.

参数

--body _VALUE_
Secret value (avoid for sensitive data).
--env _ENVIRONMENT_
Target deployment environment.
--org _ORGNAME_
Set organization secret.
--repos _REPOS_
Limit to specific repositories.
--visibility _SCOPE_
Secret visibility scope.
--help
Display help information.

FAQ

What is the gh-secret-set command used for?

gh secret set creates or updates encrypted secrets for GitHub Actions. When run interactively, it prompts for the secret value securely without echoing to the terminal. The command encrypts secrets using repository or organization public keys before transmission. Secrets can be scoped to specific environments for deployment workflows or to selected repositories in organizations. Pipe or redirect input to avoid exposing secrets in shell history.

How do I run a basic gh-secret-set example?

Run `gh secret set [SECRET_NAME]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --body _VALUE_ do in gh-secret-set?

Secret value (avoid for sensitive data).