您的位置:首页 > 编程语言

提示git error: failed to push some refs to 'git@github.com:

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

$ git push -u origin master
To git@github.com:xxx/xxx.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com: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
相关文章推荐