gh repo deploy-key add
gh repo deploy-key add <key-file> [flags]
将部署密钥添加到 GitHub 仓库。
请注意,通过 gh 添加的任何密钥都将与当前身份验证令牌关联。如果您从帐户中取消授权 GitHub CLI 应用程序或身份验证令牌,则通过 GitHub CLI 添加的任何部署密钥也将被删除。
选项
-w
,--allow-write
- 允许对密钥进行写访问
-t
,--title <string>
- 新密钥的标题
从父命令继承的选项
-R
,--repo <[HOST/]OWNER/REPO>
- 使用 [HOST/]OWNER/REPO 格式选择另一个仓库
示例
# generate a passwordless SSH key and add it as a deploy key to a repository
$ ssh-keygen -t ed25519 -C "my description" -N "" -f ~/.ssh/gh-test
$ gh repo deploy-key add ~/.ssh/gh-test.pub