更新被拒绝,因为遥控器包含您所做的工作

时间:2017-10-17 16:25:10

标签: git bitbucket

我试图将本地存储库移动到bitbucket,我关注此https://cloud.google.com/storage/transfer/create-url-list但是当我这样做时

git push --all bitbucket 

我收到了以下meessage错误:

To https://bitbucket.org/growtec/offshore.git
 ! [rejected]        Leonardo -> Leonardo (fetch first)
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://lrslima@bitbucket.org/growtec/offshore.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我在主分支上,我已经做了git pull,但输出是Everything最新的。

我看到了这个tutorial,但它对我不起作用

6 个答案:

答案 0 :(得分:3)

如果一切都已经是最新的。尝试git push -f origin master. -f代表强制提交。希望这会有所帮助。

答案 1 :(得分:2)

您在git pull分支上执行了master,但如果仔细查看git push --all bitbucket命令正在执行的操作,它也会尝试推送{{1}分支,你从来没有拉过。您也可以尝试拉动此分支,然后再次全部推送:

Leonardo

答案 2 :(得分:0)

git pull origin master
git fetch origin Leonardo:Leonardo
git push --all bitbucket

答案 3 :(得分:0)

仅在终端使用此代码:

git push -f原始主机

答案 4 :(得分:0)

您需要拉出(或获取并合并)两个分支母版,莱昂纳多解决所有冲突提交,然后再次按下

答案 5 :(得分:0)

这解决了我的问题 Github "Updates were rejected because the remote contains work that you do not have"

git remote add origin [//your github url]

//pull those changes

git pull origin master 

// or optionally, 'git pull origin master --allow-unrelated-histories' if you have 
initialized repo in github and also committed locally

//now, push your work to your new repo

git push origin master