git push遇到错误: [rejected]master -> master (non-fast-forward)的解决方法

执行git push只之后报如下错误:

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 origin master --allow-unrelated-histories //把远程仓库和本地同步,消除差异
git add .
git commit -m '***'
git push origin master


 

你可能感兴趣的:(git)