提示git error: failed to push some refs to '[email protected]:

今天重新安装了Git,远程推送到Github上进行测试,在GitHub上的仓库是存在的,在远程推送时总是出现以下错误:

$ git push -u origin master
To [email protected]:xxx/xxx.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]:xxx/xxx.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 origin master  

然后你就看到了远程文件已经下载到你的工程里面并且自动合并了。

然后你需要在本地库中添加新文件并且提交。

然后你运行

    git push -u origin master. 


问题解决!!!!

你可能感兴趣的:(git)