gpt4 book ai didi

git - 我可以在本地编辑 main.workflow github-actions 文件吗?

转载 作者:行者123 更新时间:2023-12-03 03:29:48 26 4
gpt4 key购买 nike

如果我在本地更改我的 main.workflow 文件,而不是在 master 分支中,提交并推送更改,我会从 push< 收到此错误命令:

> git diff
diff --git a/.github/main.workflow b/.github/main.workflow
index 135d8ea..0a13a28 100644
--- a/.github/main.workflow
+++ b/.github/main.workflow
@@ -6,7 +6,7 @@ workflow "Build and Test in PR" {
]
}

-action ".NET Core CLI" {
+action ".NET Core CLI" {
uses = "./.github/net-core/"
args = "test"
}

> git push
! [remote rejected] my-branch -> my-branch (refusing to allow an integration to create or update .github/main.workflow)
error: failed to push some refs to 'https://github.com/my-user-name/my-repo.git'

最佳答案

即使使用 .yml 工作流程文件,仍然遇到此问题。事实证明,对我来说,这是因为我使用了 HTTPS 远程而不是 SSH。

为了在 Github API 中解决此问题,我只是使用 SSH 远程而不是 HTTPS。

您可以通过以下方式查看您使用的是 HTTPS 还是 SSH

$ git remote -v
> origin https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin https://github.com/USERNAME/REPOSITORY.git (push)

注意是否有 https:// 而不是 git (SSH)。

然后做

git remote set-url origin git@github.com:USERNAME/REPOSITORY.git

然后验证更改

$ git remote -v
# Verify new remote URL
> origin git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin git@github.com:USERNAME/REPOSITORY.git (push)

进一步阅读:Github 文档 Switching remote URLs from HTTPS to SSH

关于git - 我可以在本地编辑 main.workflow github-actions 文件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56600686/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com