将提交推送到github仓库会引发错误

问题描述 投票:1回答:1

我得到的错误:

To https://github.com/Git-Username/Repo.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/user/repo.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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我正在执行的命令:

git push origin master

当我搜索此错误时,我尝试了几乎所有方法,我尝试了拉等方法。

github git-bash git-push
1个回答
1
投票

我尝试拉等。

拉动应该足以解决问题。

但是如果您的本地历史记录是正确的(git log),并且您是该存储库中唯一的一个Pushig,则也可以简单地强制推送

git push --force -u origin master

这将覆盖遥控器上的历史记录。

© www.soinside.com 2019 - 2024. All rights reserved.