git 上传报错! [rejected] master -> master (non-fast-forward)解决方法

上传报如下错误:

Username for 'https://gitee.com': **@**.com
fatal: unable to get credential storage lock: File exists
To https://gitee.com/**/**.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/**/**.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 username(gitee上的username) master --allow-unrelated-histories //把远程仓库和本地同步,消除差异
git add .
git commit -m '***'
git push username(gitee上的username) master

把远程仓库和本地同步,消除差异,可能会 出现如下窗口:

解决方案:

1、当出现上述情况,可按键盘左上角的“Ese”退出键;

2、输入“:wq”,注意是英文输入状态下的冒号,然后按下“Enter”键即可。( “ :wq”是啥意思呢???Linux操作系统时的命令: 强制性写入文件并退出。)。

猜你喜欢

转载自blog.csdn.net/pinhmin/article/details/129615625