【问题标题】:GitLab pipeline stopped working (pre-receive hook declined)GitLab 管道停止工作(预接收挂钩被拒绝)
【发布时间】:2022-11-10 15:07:27
【问题描述】:

我的 GitLab 管道曾经完美地工作,但现在我收到以下错误:

$ git config --global user.email "${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}"
$ git config --global user.name "${GIT_USER_NAME:-$GITLAB_USER_NAME}"
$ git clone git@gitlab.com:my_repo_url
$ python folder/run.py
$ cp *.pdf folder/Guides || echo "No pdfs found"
$ cd folder
$ git add *.pdf
$ git commit -m "${CI_PROJECT_NAME} - ${CI_COMMIT_TITLE}" || echo "No changes to commit"
[main 29197a2] proj_name - update title
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 Guides/proj_name.pdf
$ git push origin -o ci.skip || echo "Push failed"
remote: GitLab: You are not allowed to push code to this project.
To gitlab.com:my_repo_url
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.com:my_repo_url'
Push failed

没有对 repo 进行任何设置更改。 main 分支不受保护。

我试图检查另一个分支并提交,但收到完全相同的错误。

我还应该尝试什么?

【问题讨论】:

  • You are not allowed to push code to this project. What else should I try? 您应该尝试使用生成的部署令牌授权自己,并具有适当的权限以推送到存储库。
  • @KamilCuk 已经完成(使用部署密钥) - 这曾经可以工作并且没有任何改变......
  • @Leo我认为你不能使用部署密钥推送,部署密钥只允许克隆/获取/拉取。
  • @phd - 它曾经工作......

标签: git gitlab continuous-integration cicd


【解决方案1】:

事实证明,使用的部署密钥是由不再是 repo 成员的人创建的。

我创建了一个新密钥,与我的用户一起设置它,然后修复它。

文档声明Public deploy key: Access can be granted to any project in a GitLab instance. Access to each project must be granted by a user with at least the Maintainer role.,但我不明白密钥绑定到注册它的用户。

【讨论】:

    猜你喜欢
    • 2012-01-03
    • 2020-07-19
    • 2012-03-21
    • 1970-01-01
    • 2020-03-12
    • 2015-04-03
    • 1970-01-01
    • 2019-10-16
    • 1970-01-01
    相关资源
    最近更新 更多