执行git push 时报错内容
! [rejected] master -> master (fetch first)
error: failed to push some refs to ‘https://github.com/…’
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.
解决方法:
对GitHub已存在的仓库进行更新时
- 先把GitHub上要操作的仓库取到本地
git clone 加URL - 新建文件
vi 文件名 - 将新建文件从工作区添加到缓存区
git add 上传文件名 - 将新建文件从缓存区提交到本地仓库
git commit -m “描述” - 将本地仓库文件同步到远程仓库
git push
本文介绍了解决在执行GitPush操作时遇到的特定错误的方法。当尝试推送更改到GitHub仓库时,可能会遇到拒绝推送的错误,这通常是因为远程仓库中存在本地没有的工作。文章提供了详细的步骤来解决这个问题,包括克隆仓库、添加和提交文件,以及如何正确地将本地更改推送到远程仓库。
4516

被折叠的 条评论
为什么被折叠?



