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

当我使用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 commit -m "your msg"

其他回答

如果您是第一次在GitHub页面上部署站点,只需运行这两个命令。

git commit -m "initial commit"
git push origin +HEAD

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

我在GitHub帮助(处理非快进错误)中找到了这个问题的解决方案:

你可以通过获取并合并在远程分支上所做的更改和你在本地所做的更改来修复这个问题: $ git获取原点 获取在线存储库的更新 $ git合并起源分支 #将在线更新与本地工作合并 或者,你可以简单地使用git pull一次执行这两个命令: $ git拉起源分支 #获取在线更新,并将其与您的本地工作合并

对我来说,是我的哈士奇包裹阻止了我的推进。

> husky - pre-push hook failed (add --no-verify to bypass)
> husky - to debug, use 'npm run prepush'
error: failed to push some refs to 'https://username@bitbucket.org/username/my-api.git'

要强制执行,只需运行git push origin master——no-verify

我运行npm run prepush来调试错误,这就是原因:

npm ERR! code ELOCKVERIFY
npm ERR! Errors were found in your npm-shrinkwrap.json, run  npm install  to fix them.
npm ERR!     Invalid: lock file's loopback-utils@0.8.3 does not satisfy loopback-utils@^0.9.0

运行npm install并提交,问题就解决了。

我得到了这个错误,因为我试图在没有提交的情况下进行push 所以试着

Git添加。 Git commit -m "message" Git push -f

然后它对我很有效