2014-11-04 62 views
4

在Bitbucket上,使用Bitbucket的網絡界面,我同步了一個有自己的私人分支的有福的回購出錯。我想重寫這個幸運回購的歷史記錄,讓它恢復正確的提交。Bitbucket上的Git歷史重寫[遠程拒絕] HEAD - >分支(預接收鉤子拒絕)

我克隆包含不正確我的提交和本地得天獨厚的回購上,其歷史被搞砸了分公司跑

git reset --hard HEAD~1 

這使得克隆的repo回到了我在搞砸之前的提交。

我後來去把我的回購請在使用

git push -f origin development 

到到位桶,但有以下錯誤

remote: permission denied to force push branch development 
To [email protected]:blessed-repo/blessed-repo.git 
! [remote rejected] HEAD -> development (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:blessed-repo/blessed-repo.git' 

爲什麼我得到這個錯誤,以及如何可以使git push工作?

回答

12

在Bitbucket中,有可能使用limit push powers來阻止用戶直接推送到分支。

從上面的文檔...

用戶可以自由地在他們的本地克隆一個分支交互。當 他們試圖推送到Bitbucket遠程,不允許 推送到分支的用戶收到消息,遠程拒絕 推送。

您可以看到如何實施典型工作流程。

啓用直接對這些分支推到一個分支上回購

轉到

回購>設置>分公司管理>阻止歷史重新寫入(重訂)

然後取出分支你正在推動。

這將然後允許您運行git push origin +HEAD

那麼你應該分支重新添加到列表中,以防止隨意推向回購。