赞
踩
多种方法解决 git 推送push代码出现github远程分支拒绝[remote rejected] (push declined due to repository rule violations。
出现错误类似如下:
11:07:29.408: [goutils] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin 40e3c6c07ca483573ea5077acb6d6d4426c0ef9a:refs/heads/main
Enumerating objects: 30, done.
Counting objects: 3% (1/30)
Counting objects: 6% (2/30)
Counting objects: 10% (3/30)
Counting objects: 13% (4/30)
Counting objects: 16% (5/30)
Counting objects: 20% (6/30)
Counting objects: 23% (7/30)
Counting objects: 26% (8/30)
Counting objects: 30% (9/30)
Counting objects: 33% (10/30)
Counting objects: 36% (11/30)
Counting objects: 40% (12/30)
Counting objects: 43% (13/30)
Counting objects: 46% (14/30)
Counting objects: 50% (15/30)
Counting objects: 53% (16/30)
Counting objects: 56% (17/30)
Counting objects: 60% (18/30)
Counting objects: 63% (19/30)
Counting objects: 66% (20/30)
Counting objects: 70% (21/30)
Counting objects: 73% (22/30)
Counting objects: 76% (23/30)
Counting objects: 80% (24/30)
Counting objects: 83% (25/30)
Counting objects: 86% (26/30)
Counting objects: 90% (27/30)
Counting objects: 93% (28/30)
Counting objects: 96% (29/30)
Counting objects: 100% (30/30)
Counting objects: 100% (30/30), done.
Delta compression using up to 8 threads
Compressing objects: 5% (1/19)
Compressing objects: 10% (2/19)
Compressing objects: 15% (3/19)
Compressing objects: 21% (4/19)
Compressing objects: 26% (5/19)
Compressing objects: 31% (6/19)
Compressing objects: 36% (7/19)
Compressing objects: 42% (8/19)
Compressing objects: 47% (9/19)
Compressing objects: 52% (10/19)
Compressing objects: 57% (11/19)
Compressing objects: 63% (12/19)
Compressing objects: 68% (13/19)
Compressing objects: 73% (14/19)
Compressing objects: 78% (15/19)
Compressing objects: 84% (16/19)
Compressing objects: 89% (17/19)
Compressing objects: 94% (18/19)
Compressing objects: 100% (19/19)
Compressing objects: 100% (19/19), done.
Writing objects: 5% (1/19)
Writing objects: 10% (2/19)
Writing objects: 15% (3/19)
Writing objects: 21% (4/19)
Writing objects: 26% (5/19)
Writing objects: 31% (6/19)
Writing objects: 36% (7/19)
Writing objects: 42% (8/19)
Writing objects: 47% (9/19)
Writing objects: 52% (10/19)
Writing objects: 57% (11/19)
Writing objects: 63% (12/19)
Writing objects: 68% (13/19)
Writing objects: 73% (14/19)
Writing objects: 78% (15/19)
Writing objects: 84% (16/19)
Writing objects: 89% (17/19)
Writing objects: 94% (18/19)
Writing objects: 100% (19/19)
Writing objects: 100% (19/19), 11.99 KiB | 3.00 MiB/s, done.
Total 19 (delta 9), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 0% (0/9)
remote: Resolving deltas: 11% (1/9)
remote: Resolving deltas: 22% (2/9)
remote: Resolving deltas: 33% (3/9)
remote: Resolving deltas: 44% (4/9)
remote: Resolving deltas: 55% (5/9)
remote: Resolving deltas: 66% (6/9)
remote: Resolving deltas: 77% (7/9)
remote: Resolving deltas: 88% (8/9)
remote: Resolving deltas: 100% (9/9)
remote: Resolving deltas: 100% (9/9), completed with 9 local objects.
remote: error: GH013: Repository rule violations found for refs/heads/main.
remote:
remote: - GITHUB PUSH PROTECTION
remote: —————————————————————————————————————————
remote: Resolve the following violations before pushing again
remote:
remote: - Push cannot contain secrets
remote:
remote:
remote: (?) Learn how to resolve a blocked push
remote: https://docs.github.com/code-security/secret-scanning/pushing-a-branch-blocked-by-push-protection
remote:
remote: (?) This repository does not have Secret Scanning enabled, but is eligible. Enable Secret Scanning to view and manage detected secrets.
remote: Visit the repository settings page, https://github.com/AbnerEarl/goutils/settings/security_analysis
To https://github.com/AbnerEarl/goutils.git
remote:
! 40e3c6c07ca483573ea5077acb6d6d4426c0ef9a:refs/heads/main [remote rejected] (push declined due to repository rule violations)
remote:
Done
remote: —— Alibaba Cloud AccessKey ID ————————————————————————
remote: locations:
remote: - commit: 40e3c6c07ca483573ea5077acb6d6d4426c0ef9a
remote: path: tlogin/alioss.go:29
remote:
remote: (?) To push, remove secret from commit(s) or follow this URL to allow the secret.
remote: https://github.com/AbnerEarl/goutils/security/secret-scanning/unblock-secret/2gU79tijxacDeMrROeRocrk4cOD
remote:
remote:
remote: —— Alibaba Cloud AccessKey Secret ————————————————————
remote: locations:
remote: - commit: 40e3c6c07ca483573ea5077acb6d6d4426c0ef9a
remote: path: tlogin/alioss.go:32
remote:
remote: (?) To push, remove secret from commit(s) or follow this URL to allow the secret.
remote: https://github.com/AbnerEarl/goutils/security/secret-scanning/unblock-secret/2gU79tHxe6gzcQtzAzJvcAjXdnM
remote:
remote:
remote:
error: failed to push some refs to ‘https://github.com/AbnerEarl/goutils.git’
解决方法,这里有三种方法:
1)删除代码里面的定义的 secret 相关的值,重新commit,再push。
2)修改仓库的配置关闭secret检测,步骤如下:
3)通过 push 提示给出的访问链接进行许可添加,步骤如下:
最后,再次 push 就可以了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。