今天上午写项目的时候在git的时候出现了这样的错误:
Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib $ git remote add origin https://github.com/crifan/crifanLib.git Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib $ git remote -v origin https://github.com/crifan/crifanLib.git (fetch) origin https://github.com/crifan/crifanLib.git (push) Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib $ git push origin master Username for 'https://github.com': Password for 'https://admin@crifan.com@github.com': To https://github.com/crifan/crifanLib.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/crifan/crifanLib.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details.
出错了。
很明显是:
本地没有update到最新版本的项目(git上有README.md文件没下载下来)
本地直接push所以会出错。
搜:
error: failed to push some refs to
http://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to
Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib $ git pull --rebase origin master From https://github.com/crifan/crifanLib * branch master -> FETCH_HEAD First, rewinding head to replay your work on top of it... Applying: add local crifanLib to github
可以看到,此时已经把github上最新的文件下载下来了:
接着再去:
git push origin master
Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib $ git push origin master Username for 'https://github.com': Password for 'https://crifancrifancrifan@github.com': Counting objects: 19, done. Delta compression using up to 4 threads. Compressing objects: 100% (14/14), done. Writing objects: 100% (18/18), 112.33 KiB, done. Total 18 (delta 0), reused 0 (delta 0) To https://github.com/crifan/crifanLib.git 6bae951..32d67c7 master -> master
即可成功把本地的文件都上传到github上面去了。
此时再去github网站上也就可以看到对应文件了。。