git 提交出现 Updates were rejected 解决方案
git remote add 添加一个远程地址
但提交出现以下报错
failed to push some refs to 'https://gitee.com/xxxxx/xxx-admin.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and 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.
解决
也就是说,如果您确定处于分离状态的master版本是您真正想要保留的版本,那么您可以通过强制将分支推送到远程来避免非快进错误:
git push origin HEAD:master --force
但是,如果强制推送,则可能会给签出该分支的所有其他用户造成问题。风险较小的解决方案是从分离的头创建一个临时分支,然后将该分支合并到主分支中:
git branch temp-branch
git checkout master
git merge temp-branch
git push origin master
爱生活、爱编程!