我正在尝试将我的文件推送到GitHub上的repo,我收到一个错误.谁能帮助解释我做错了什么?
正在抛出一条错误消息,但我无法理解它(我是Git的新手......)
git push -u origin master
> To https://github.com/URL ! [rejected] master -> master (fetch
> first) error: failed to push some refs to 'https://URL' 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.
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.
发生这种情况是因为在服务器上您有本地没有的更改.
请遵循以下
git pull origin mastergit push origin master通常发生在有人在你拉扯之后推进远程分支时.因此,您的提交历史记录与服务器提交历史记录不同.在这种情况下,如果git允许你推送,服务器上的提交历史(真相来源)将会被改变,而且从回购中获取的人也会面临冲突.因此,你的推动被拒绝.
但是,如果您非常确定它是一个新的repo并且没有人对主遥控器进行任何更改(如下面的评论中所述)运行此git push -f origin master
| 归档时间: |
|
| 查看次数: |
593 次 |
| 最近记录: |