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.
VBNET 复制 全屏
解决
也就是说,如果您确定处于分离状态的master版本是您真正想要保留的版本,那么您可以通过强制将分支推送到远程来避免非快进错误:git push origin HEAD:master --force
但是,如果强制推送,则可能会给签出该分支的所有其他用户造成问题。风险较小的解决方案是从分离的头创建一个临时分支,然后将该分支合并到主分支中:文章来源:https://uudwc.com/A/W1gdL
git branch temp-branch
git checkout master
git merge temp-branch
git push origin master
说明 Git推动主人致命:你目前不在分支上 - IT屋-程序员软件开发技术分享社区文章来源地址https://uudwc.com/A/W1gdL