使用 gh cli 公开秘密要点

问题描述 投票:0回答:1

我不小心通过

gh
(GitHub) CLI 创建了一个要点作为秘密要点。

我想现在公开这个秘密要点。我可以使用什么 CLI 命令来实现此目的?或者 CLI 中尚不提供此功能?

我知道我可以在浏览器中打开要点并单击“公开”,但这很乏味。

如果 cli 不支持发布,是否有使用 Github API 的解决方法?

github github-api gist github-cli
1个回答
0
投票

既没有

gh
命令,也没有 GitHub API 可以将秘密要点重新公开为公开。此问题的唯一自动化解决方案是重新创建要点

这是一种自动化的方法:

# Filename used when gist was originally created
file=my-gist.sh

# Find gist ID
id=$(gh gist list|grep $file|cut -f1)

# Capture gist content
gh gist view $id > $file

# Delete old gist
gh gist delete $id

# Create new public gist with the same content
gh gist create $file --public
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.