Git Gui 我无法推送到 Github

Git Gui I can't push to Github

我无法将文件推送到 Github。 错误:

Pushing to https://github.com/Brogolem35/project.git
To https://github.com/Brogolem35/project.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Brogolem35/project.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 Bash。它给了我同样的问题。

你要么:

  1. 执行git pull ...,尝试合并并解决冲突(如果有),那么您将能够git push OR
  2. git push -f ...。但是要小心这个,只有当你重新定位你的本地存储库并想推送到一个非 public 分支时才应该使用它。

如果您不确定要做什么,第一个是最安全的选择。

请阅读留言:

error: failed to push some refs to 'https://github.com/Brogolem35/project.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 push origin master --force

效果很好。

发帖人询问如何在 Git GUI 中执行此操作。我有同样的问题并通过使用合并菜单选项解决了它