![](/img/trans.png)
[英]BitBucket/Git error: You can only push your own commits in this repository
[英]Error in git: You can only push your own commits in this repository
昨天我在嘗試將我的提交推送到 repo 時開始收到錯誤,如何解決? 而且我不是這個 repo 的管理員。
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'
謝謝大家,問題解決了。 問題出在 Bitbucket 方面,管理員更改了一些選項。 現在一切正常。
謝謝大家,問題解決了。 問題出在 Bitbucket 方面,管理員更改了一些選項。 現在一切正常。
更新
根據提出問題的@Oleg。 問題通常是由於 Bitbucket 掛鈎而發生的。 此鈎子將拒絕任何包含推送到服務器的用戶未提交的提交的推送。
要解決問題:
在將其推送到 bitbucket 之前,您需要設置您的身份
git config --global user.email "Your Email"
git config --global user.name "Your Name"
git push origin <branch-name>
轉到您的回購瀏覽器並檢查您的個人資料中的用戶名和電子郵件(右上角)
在 git bash 中根據您的 git web 配置文件更新您的詳細信息 git config --global user.email "your@email.com" git config --global user.name "USERNAME"
您需要撤消提交,然后在步驟 2 中更改用戶詳細信息后重做
推送更改 git push
您必須撤消具有不正確電子郵件地址的提交,然后如下所述更新 git 配置。 如果您提交了多次,您可能需要挑選然后提交,但只有在運行完這些步驟之后:
# remove "--global" if you only want to update it for the local repo
git config --global user.email "Your Email"
git config --global user.name "Your Name"
進行新的提交,然后您應該能夠推送。
如果設置user.email和user.name后問題仍然存在? 您可能需要更改您的提交作者日志以匹配該用戶。 只需在 cmd 下運行之前檢查 git 日志。
git commit --amend --reset-author --no-edit
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.