使用git真的是让我受尽了折磨,不写个集合都觉得对不起自己踩过的那些坑啊错误一:failed to push some refs to git $ git push -u origin masterTo git@github.com:yangchao0718/cocos2d.git! [rejected] master -> master (non-fast-forward)error: failed to push some refs to ‘git@github.com:yangchao0718/cocos2d.githint: Updates were rejected because the tip of your current branch is behinhint: its remote counterpart. Integrate the remote changes (e.g.hint: ‘git pull …’) before pushing again.出现错误的主要原因是github中的README.md文件不在本地代码目录中可以通过如下命令进行代码合并【注:pull=fetch+merge]git pull –rebase origin master执行上面代码后可以看到本地代码库中多了README.md文件此时再执行语句 git push -u origin master即可完成代码上传到github