网站首页 > 精选文章 正文
Git推送错误:failed to push some refs to 'git@gitee.com:XXX'
wudianyun 2024-12-16 13:44:31 精选文章 42 ℃
项目推送时遇Git推送错误:
error: failed to push some refs to ‘git@gitee.com:name/project.git’
1、分析:
这个问题的产生是因为远程仓库与本地仓库并不一致所造成。
2、解决方案:
那么我们把远程库同步到本地库就可以了。
执行命令:
git pull --rebase origin master
将远程仓库中的更新合并到本地仓库,–rebase的作用是取消掉本地仓库中刚刚的commit
然而未果,出现错误:
error: src refspec master does not match any
分析:引起该错误的原因是,目录中没有文件,空目录不能提交。
依次执行:
git pull origin master git push origin master
解决!
一般而言,正常的推送流程应为:
1、在github上创建项目 2、使用git clone https://github.com/name/project.git克隆到本地 3、编辑项目 4、git add . (将变更提交至缓存区) 5、git commit -am “提交说明(注释)” 6、git push origin master 将本地变更推送至远程仓库master分支
此时如果在github的remote上已经有了文件,会出现error。那么应当先pull一下,即:
git pull origin master
随即push即可。
git push origin master
- 上一篇: 用git来管理硬件设计文件
- 下一篇: git 实现一份代码push到两个git地址上
猜你喜欢
- 2024-12-16 Git 两个常见错误
- 2024-12-16 SVN与Git的区别,读完之后,大部分程序员都收藏了...
- 2024-12-16 这样配置使用GIT命令clone/push/pull等不再重复输入密码
- 2024-12-16 Git常用操作
- 2024-12-16 git清除历史纪录
- 2024-12-16 如何使用 Git 工作树(Worktrees)来提高工作效率
- 2024-12-16 我写一个git用法吧
- 2024-12-16 一篇文章明白Git的14条常用命令
- 2024-12-16 掌握git命令,图解一目了然
- 2024-12-16 Git 版本控制:团队协作与项目管理的利器
- 最近发表
- 标签列表
-
- 向日葵无法连接服务器 (32)
- git.exe (33)
- vscode更新 (34)
- dev c (33)
- git ignore命令 (32)
- gitlab提交代码步骤 (37)
- java update (36)
- vue debug (34)
- vue blur (32)
- vscode导入vue项目 (33)
- vue chart (32)
- vue cms (32)
- 大雅数据库 (34)
- 技术迭代 (37)
- 同一局域网 (33)
- github拒绝连接 (33)
- vscode php插件 (32)
- vue注释快捷键 (32)
- linux ssr (33)
- 微端服务器 (35)
- 导航猫 (32)
- 获取当前时间年月日 (33)
- stp软件 (33)
- http下载文件 (33)
- linux bt下载 (33)