赞
踩
错误提示为:
To github.com:PorterLi/myDataStructCode.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git@github.com:PorterLi/myDataStructCode.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 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.
原因:
远程仓库有本地没有的文件。即,两个仓库不同步,这种情况下需要利用git pull 命令合并两个仓库。
解决方法:
1.先利用git add 和git commit 将本地暂存区的内容添加到仓库
2.git status 查看本地仓库内容,如下则可进行第三步
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
3.命令如下,合并两个仓库。
git pull --rebase origin master
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。