Github“更新被拒绝,因为远程包含你没有的工作” [英] Github "Updates were rejected because the remote contains work that you do not have"

查看:405
本文介绍了Github“更新被拒绝,因为远程包含你没有的工作”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个新的repo,克隆它,将文件添加到目录中,添加了 add -A ,提交的更改,以及当我尝试使用 git push< repo name> master 我得到更新被拒绝,因为远程包含你没有的工作。



这似乎没有道理,因为这是一个新的回购协议,并且只包含一个自述文件。 如果你用<$ c $初始化一个新的github仓库,会发生这种情况c> README 和/或 LICENSE file

  git remote add origin [//你的github url] 

//拉取这些变化

git pull原点大师

//现在,推动你的工作到你的新回购

git push origin master

现在你将能够推送您的存储库到github。基本上,你必须将这些新的初始化文件与你的工作合并。 git pull 为您提取并合并。如果适合您,您也可以获取并合并。


I created a new repo, cloned it, added files to the directory, added them with add -A, committed changes, and when I try to push using git push <repo name> master I get "Updates were rejected because the remote contains work that you do not have".

This doesn't seem to make sense since it's a new repo and contains only a readme file.

解决方案

This happens if you initialized a new github repo with README and/or LICENSE file

git remote add origin [//your github url]

//pull those changes

git pull origin master

//now, push your work to your new repo

git push origin master

Now you will be able to push your repository to github. Basically, you have to merge those new initialized files with your work. git pull fetches and merges for you. You can also fetch and merge if that suits you.

这篇关于Github“更新被拒绝,因为远程包含你没有的工作”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆