当我使用命令时,git push origin master
将显示以下错误:
Username for 'https://github.com': amithld
To https://github.com/amithld/datasciencecoursera.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/amithld/datasciencecoursera.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不知道如何应用此后所做的工作。您可以通过执行以下操作解决此问题:
git pull origin master # merge the remote into your local branch
或者
git pull --rebase origin master # rebase your local branch on the remote
在此之后,以下应该理想地工作:
git push origin master
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句