上传本地服务器的项目至Gitee遇到的问题
1、pull失败
- 输入命令:git pull origin master
- 提示信息:
Merge branch 'master' of https://gitee.com/user_name/test Please enter a commit message to explain why this merge is necessary, especially if it merges an updated upstream into a topic branch. Lines starting with '#' will be ignored, and an empty message aborts the commit.
- 提示信息解释:Git合并分支的命令,
- 解决方案
1.按键盘字母 i 进入insert模式
2.修改最上面那行合并信息,改为自己的提交信息 。可以不修改
3.按键盘左上角"Esc"
4.输入" :wq",冒号+wq,按回车键即可 - 注:如果不改合并信息 可以直接走3,4两步就OK
- 上述问题解决完之后,继续使用git push -u origin master即可
2、push失败
- 输入命令:git push -u origin master
- 报错信息:
To https://gitee.com/yffannlp/cs-reasoning-metric-learning.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://gitee.com/yffannlp/cs-reasoning-metric-learning.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first merge the remote changes (e.g., hint: 'git pull') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
- 解决方案:重新pull,使用git pull origin master命令,再次push,使用git push -u origin master命令即可