我收到以下错误.我如何解决?:git add.git commit -m't'git push origin development
To git@github.com:myrepo.git
! [rejected] development -> development (non-fast-forward)
error: failed to push some refs to 'git@github.com:myrepo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)
Dan*_*ter 70
您的原始存储库位于本地存储库之前.在推送之前,您需要从原始存储库中下拉更改,如下所示.这可以在您的提交和推送之间执行.
git pull origin development
Run Code Online (Sandbox Code Playgroud)
development指的是你要从中拉出的分支.如果你想从master分支拉出然后输入这个.
git pull origin master
Run Code Online (Sandbox Code Playgroud)
我使用了这个命令,它对我来说很好用:
>git push -f origin master
Run Code Online (Sandbox Code Playgroud)
但请注意,这可能会删除您在远程仓库中已有的一些文件。由于场景不同,这对我很有用。我正在将我的本地项目推送到远程仓库,该仓库是空的,但 READ.ME
我也收到错误 ! [remote rejected] main -> main (failure) error: failed to push some refs to '<repository>'。
查了一下才知道原因是这样的:
小智 6
我遇到了同样的问题并解决如下(如果您在本地文件夹中有一个项目,请按照步骤操作):
小智 6
就我而言。我遇到错误是因为我在 github 上创建存储库到现有项目后忘记进行提交。所以我解决了:
git add .
git commit -m"commentary"
Run Code Online (Sandbox Code Playgroud)
然后我就可以输入:
git push -u origin master
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
92612 次 |
| 最近记录: |