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

来源:互联网 发布:网络稳定性测试软件app 编辑:程序博客网 时间:2024/05/24 16:16

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

$ git push -u origin masterTo 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 dohint: not have locally. This is usually caused by another repository pushinghint: to the same ref. You may want to first integrate the remote changeshint: (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. 


问题解决!!!!

阅读全文
0 0
原创粉丝点击