git和 Github CLI 有什么区别?我应该使用哪一个,git或 Github CLI 或gh视情况而定?在危急情况下应该使用什么,比如有人销毁回购?我特别要求 Github CLI 而不是 Github 本身。
我怎样才能从我的分叉仓库的开发分支向上游仓库的开发分支提出 PR。我尝试了gh pr create,但给了我以下输出/错误
$ gh pr create
Warning: 3 uncommitted changes
Creating pull request for development into development in upstream-repo-org/upstream-repo
? Title permission check for edit feature moved to parent components
? Body <Received>
? What's next? Submit
pull request create failed: GraphQL error: No commits between development and development
Run Code Online (Sandbox Code Playgroud) git version-control github command-line-interface github-cli
我在 Github CLI 第一个版本发布后就开始使用它,这是一个很棒的工具。我一直在从事一个项目,该项目需要远程位于不同的地方,例如在两个存储库中。我可以添加另一个遥控器来推送更改,但 gh 只能控制第一个遥控器。例如,gh pr status具有两个或多个遥控器的存储库中的命令将仅显示原始遥控器的数据。我如何在遥控器之间切换以查看每个遥控器上的所有操作,例如问题和公关?
我已按照此处的说明在 CLI(在 Linux、Ubuntu 上)上设置 github 的自动身份验证。特别是,我执行了此处给出的命令:
gh auth login
然后我根据提示回答 Github.com,是的,HTTPS,以及我的身份验证令牌。
这似乎有效:它指出“ Configured git protocol”和“ Logged in as ...”。
但是,当我写入 时git clone <myrepo>,它会再次询问我的用户名和密码。
我究竟做错了什么?我的理解是该gh aut login命令应该防止我每次都输入登录数据。
我正在尝试使用 gh cli 访问另一个 github 存储库作为工作流程的一部分。我正在使用gh release view如下命令
run: |
echo "::set-output name=description::$(gh release view --repo <owner/repo>)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Run Code Online (Sandbox Code Playgroud)
工作流程失败并出现 404,我知道这是因为存储库是私有的,即使两个存储库具有相同的所有者。当在本地进行身份验证时,该命令可以正常工作。
有什么方法可以在工作流程中访问该存储库吗?
使用 GitHub cli (gh),如何获取当前的存储库名称?
我可以获取我拥有的存储库的列表,但如何获取当前的存储库?
如何从curl 或github cli 创建webhook?
这个文档。没有多大帮助: https://docs.github.com/en/rest/reference/repos#create-a-repository-webhook--code-samples
尝试过这个:
curl -u <user>:<token>\
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/<org>/<repo>/hooks \
-d '{"name":"name"}'
Run Code Online (Sandbox Code Playgroud)
给我留下了疑问:
-d '{"name":"name"}'错误:
{
"message": "Validation Failed",
"errors": [
{
"resource": "Hook",
"code": "custom",
"message": "Config must contain URL for webhooks"
}
],
"documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-webhook"
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 github cli (GH),并且我已经创建了一个存储库和一个本地 git 存储库,有没有办法使用 gh cli 为该 git 存储库添加远程存储库?
即使我们剪切并粘贴了之前运行的命令release not found返回的版本的精确名称,也会抛出退出代码 1 的错误。gh release list --repo $repoWithToken
GitHub 错误日志的相关部分是:
About list releases
exact_name_of_release_linux_n.1.2 _linux_n.1.2 2022-09-19T23:28:08Z
About to download release
release not found
Error: Process completed with exit code 1.
Run Code Online (Sandbox Code Playgroud)
完整的工作流程代码如下:
About list releases
exact_name_of_release_linux_n.1.2 _linux_n.1.2 2022-09-19T23:28:08Z
About to download release
release not found
Error: Process completed with exit code 1.
Run Code Online (Sandbox Code Playgroud)
该$repoWithToken变量已正确填充,因为gh release list --repo $repoWithToken命令运行时没有错误,如上面的日志所示。
以上使用此链接中的文档。
当我们更改命令以使用标签名称以gh release download _linux_n.1.2 --repo $repoWithToken更类似于链接中文档中给出的示例时,会引发相同的错误。
gh release download为了 …
我正在尝试使用GitHub CLI自动化GitHub的拉取请求创建过程的拉取请求创建过程。
\n我目前正在使用以下脚本,它的作用就像一个魅力:
\n(\n # Parentheses are used here to avoid the exposure of temporal variables to the outer scope.\n # Tested on macOS bash only.\n \n cd ~/Projects/pet_projects/basic_temperature\n \n # Pushes the release branch to the remote repository.\n git push origin release_nemo\n\n # Logs in to GitHub CLI using pre-generated access token.\n # https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token\n gh auth login --with-token < ~/Projects/pet_projects/.github_cli_access_token\n \n# Sets HEREDOC to PR_TITLE variable.\n# Indentation is avoided here intentionally.\n# https://stackoverflow.com/a/1655389/12201472\nread -r -d …Run Code Online (Sandbox Code Playgroud) 我尝试了 github cli:
gh release list | sed 's/|/ /' | awk '{print $1, $8}' | while read -r line; do gh release delete -y "$line"; done
Run Code Online (Sandbox Code Playgroud)
如此处所述:https ://dev.to/dakdevs/delete-all-releases-from-github-repo-13ad
但它仅适用于名称等于标签的版本。一旦名称中包含空格,awk 就无法正确分隔列。
也许gh自文章撰写以来 cli 输出发生了变化,或者awk在 macOS 上有不同的默认值?
我的仓库中有两个分支,即main和kaju1,
在main分支(默认)上,定义了两个工作流push.yml和test.yml。
在kaju1分支上,定义了push.yml、test.yml、 和三个工作流程pr.yml。
我想使用 github cli 在分支pr.yml上触发 ie kaju1。
我尝试使用这段代码:
gh workflow run --repo username/repo-name --ref kaju1 pr.yml
Run Code Online (Sandbox Code Playgroud)
但这返回给我以下错误:
HTTP 404: Not Found (https://api.github.com/repos/username/repo-name/actions/workflows/pr.yml)
Run Code Online (Sandbox Code Playgroud) 我正在向机器人提交任务。我看不到设置选项卡。因此,我想使用命令行来执行命令。
如何使用 git bash 命令行公开我的私有存储库?