git中的错误:您只能在此存储库中推送自己的提交

Ole*_*leg 6 git commit bitbucket-server

昨天,当我尝试将提交提交回购时,我开始收到错误,该如何解决?我不是这个仓库的管理员。

remote: You can only push your own commits in this repository
remote: Commit commitName was committed by <myName> <my@users.noreply.github.com>
To ssh://bitbucket.awg.ru/repo
 ! [remote rejected] branchName -> branchName (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@bitbucket.awg.ru/repo'
Run Code Online (Sandbox Code Playgroud)

更新资料

谢谢大家,问题解决了。问题出在Bitbucket方面,管理员更改了一些选项。现在一切正常。

mah*_*ara 11

如果设置user.emailuser.name后问题仍然存在?您可能需要更改提交作者日志以与该用户匹配。只需在 cmd 下运行之前检查 git 日志即可。

git commit --amend --reset-author --no-edit
Run Code Online (Sandbox Code Playgroud)

  • 这是唯一对我有用的东西,即使在更新了 Git 用户并通过 `git commit --amend --author="Author Name &lt;author@ Correct-email.com&gt;" --no-edit` 更改了日志之后也是如此。 。作者在日志中是“正确的”,但我仍然无法推送,直到我使用“--reset-author”标志运行此步骤。谢谢你! (2认同)

Ole*_*leg 6

谢谢大家,问题解决了。问题出在Bitbucket方面,管理员更改了一些选项。现在一切正常。

更新

按照@Oleg的问题。通常由于Bitbucket挂钩而发生问题。该挂钩将拒绝任何包含未推送到服务器的用户提交的提交的推送。

解决问题:

  • 您必须具有对Bitbucket服务器中存储库的管理员访问权限
  • 转到服务器中的存储库
  • 然后存储库设置
  • 选择挂钩
  • 禁用验证提交器挂钩
  • 大功告成

  • 但这只是一个解决方案,如果你真的想禁用它。检查提交者是 Bitbucket 的一项很好的安全功能。在这种情况下,请正确设置全局设置。这是更好的方法。 (5认同)

小智 5

您需要先设置标识,然后再将其推送到bitbucket

git config --global user.email "Your Email"
git config --global user.name "Your Name"
git push origin <branch-name>
Run Code Online (Sandbox Code Playgroud)

  • 身份已定,直到昨天一切都还好。 (2认同)