git 推送不适用于 bitbucket 存储库

git push not working on a bitbucket repository

我刚刚在我的 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 按照消息中的建议进行拉取,但均未成功。

有人可以帮我吗?

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

查看错误日志提示的内容

这样做:

git pull origin master
git push origin master

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