github - 推入 Git 时显示错误消息
问题描述
当我推入 Git 时,我发现以下错误
![rejected] master -> master (fetch first) error: failed to push some refs to ' https://github.com/smitraDA/DataScienceProject2.git ' 提示:更新被拒绝,因为远程包含你做的工作 提示:不是在当地有。这通常是由另一个存储库推送提示引起的:to the same ref. 您可能希望在再次推送之前先集成远程更改提示:(例如,'git pull ...')。提示:有关详细信息,请参阅“git push --help”中的“关于快进的说明”。
我已经克隆、添加 -A 和提交。如下:
C:\Users\Dell-672206>git clone https://github.com/smitraDA/DataScienceProject2.git 致命:目标路径“DataScienceProject2”已存在且不是空目录。
C:\Users\Dell-672206>cd DataScienceProject2
C:\Users\Dell-672206\DataScienceProject2>git add -A
C:\Users\Dell-672206\DataScienceProject2>git commit -m "version1"
我发现以下错误:
![rejected] master -> master (fetch first) error: failed to push some refs to ' https://github.com/smitraDA/DataScienceProject2.git ' 提示:更新被拒绝,因为远程包含你做的工作 提示:不是在当地有。这通常是由另一个存储库推送提示引起的:to the same ref. 您可能希望在再次推送之前先集成远程更改提示:(例如,'git pull ...')。提示:有关详细信息,请参阅“git push --help”中的“关于快进的说明”。
解决方案
在这种情况下,您必须首先从 GitHub 获取数据并将所有更改从 GitHub 拉到本地存储库,然后推送到远程存储库。您可以使用以下命令:
$ git pull origin master
$ git push origin master
推荐阅读
- mysql - MySQL 意外的字符串比较行为
- ios - 使用 CALayer 绘图总是比使用 CoreGraphics 更好吗?
- flowgear - Mac 的 Droppoint 支持
- r - 绘图问题 - 部分依赖图
- ios - 动画浮动操作按钮展开 <-> 正常
- javascript - 使用 async/await 时 nodejs 没有响应
- r - 是一种检查包裹是否属于 Bioconductor 或 Cran 的方法吗?
- javascript - 在简单的 vue 项目中设置 vue-mathjax
- kubernetes - Kubernetes环境中的API网关
- ios - 如何使用 NSOperation 或 GCD 立即执行所有延迟操作?