如何修复 GitHub 错误:以所有者身份推送到公共存储库时“无法更新此受保护的引用”

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

我在 GitHub 上创建了一个私有存储库,但现在决定将其公开。我通过 GitHub 设置将其更改为公开,并且没有更改任何其他内容。我使用 Visual Studio。当我想将本地提交推送到存储库时,它失败并生成以下控制台输出:

Remote: Error: GH013: Repository rule violations found for refs/heads/main.        
Remote: Review all repository rules at http://github.com/xxx/xxx/rules?ref=refs%2Fheads%2Fmain        
Remote: 
Remote: - Cannot update this protected ref.        
Remote: 
To https://github.com/xxx/xxx
Error: main -> main (push declined due to repository rule violations)
failed to push some refs to 'https://github.com/xxx/xxx'

我尝试通过 Git Bash 手动推送它,但它产生了相同的错误。我在 Visual Studio 中使用 GitHub 登录。我也是存储库的所有者,并且没有合作者。我尚未在 GitHub 存储库中添加任何自定义规则或角色。

git github
1个回答
0
投票

以前从未遇到过此类问题,但我的预感是,由于自初始结账以来权限已发生变化,这将阻止您推送它。

您可以尝试从公共存储库克隆并推送到它吗?应该可以工作。

祝一切顺利

© www.soinside.com 2019 - 2024. All rights reserved.