git上传问题

今天在上传代码到gitee上时,代码上传失败,提示错误:

To https://gitee.com/leaf777/imitating-jingdong-mall.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/leaf777/imitating-jingdong-mall.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 pull语句进行拉取,但是好像没有成功,终端提示

From https://gitee.com/leaf777/imitating-jingdong-mall
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories

所以好像git pull语句在这个情况下不怎么好使,百度搜索后看见一个博主的解决方法:
使用:git pull --rebase origin master语句

git pull --rebase origin master
From https://gitee.com/leaf777/imitating-jingdong-mall
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: 第一次提交

可以看出来已经成功下载了,接下来就使用 git push origin master正常提交了。
博客地址:https://blog.csdn.net/u013120247/article/details/53263169

你可能感兴趣的:(git上传问题)