我昨天还能推,现在却推不动了。

当我使用git push origin master时,我得到一个错误:

$ git remote -v
origin  https://github.com/REDACTED.git (fetch)
origin  https://github.com/REDACTED.git (push)

$ git push origin master
Username for 'https://github.com': REDACTED
Password for 'https://REDACTED@github.com':
To https://github.com/REDACTED.git
! [rejected]         master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/REDACTED.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 checkout -b <nameOfNewBranch>

正如预期的那样,不需要合并,因为前一个分支完全包含在新分支中。

其他回答

如果你使用git-with-ssh,它不起作用的一个原因是它可能指向错误的ssh-private-key文件或correct-file-wrong-private-key文件。如果我没记错的话,我最近在添加ssh-private-key时遇到了一些困难。所以我清空了那些妓女特工

ssh-add -D

然后一切都正常了!

git init Git远程添加origin https://gitlab.com/crew-chief-systems/bot Git remote -v(用于检查当前存储库) 添加所有文件 git commit -m '添加我的项目' Git pull -rebase origin master Git push origin master

我也有同样的问题。我遇到这个问题是因为我没有做出任何承诺,甚至没有最初的承诺,但我仍然试图推动。

一旦我真的commit -m“your msg”,一切都很正常。

我创建了一个自定义预推送文件,我忘记以exit 0结束它。

这导致我得到这个“未能推动一些裁判”错误。我将exit 0添加到pre-push hook的末尾,当然,现在它工作得很好。

对我来说,问题是我没有在提交之前添加文件。

转到添加 。

Git commit -m "your msg"