首页 > 解决方案 > git push 在 bitbucket 存储库上不起作用

问题描述

我刚刚在我的 Bitbucket 帐户上创建了一个存储库。我的笔记本电脑上已经写了一个代码。这是我在终端上执行的命令:

git init
git add --all
git commit -m 'Initial commit'
git remote add origin https://<repo_owner_name>@bitbucket.org/<teamname>/<reponame>.git
git push origin master

我收到以下错误:

 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://bitbucket.org/EtienneVergne/disney-app-proposal.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

我已经按照消息中的建议尝试了几次 git pull ,但没有成功。

有人可以帮助我吗?

标签: bitbucketgit-push

解决方案


这是因为远程仓库和本地仓库不同步。

查看错误日志提示的内容

做这个:

git pull origin master
git push origin master

git push -f origin master覆盖远程更改。


推荐阅读