Git使用push提交代码报错解决
发布日期:2021-10-12 17:51:36
浏览次数:2
分类:技术文章
本文共 1010 字,大约阅读时间需要 3 分钟。
操作步骤及原因分析:
1、git新建了一个项目,需要把本地的项目提交到git上的新项目 2、进入本地项目文件夹根目录 3、初始化git init
4、 git remote add origin http://Xiaoxiaoxiao@git.enheng.net/frame/lf-file-service-upload-client.git
git add .
6、提交并填写备注信息 git commit -m 'init'
7、推送代码到master分支 git push -u origin master
执行第7步可能出现的错误信息:
error 1、error: src refspec dev does not match any. error: failed to push some refs to 'http://Xiaoxiaoxiao@git.enheng.net/frame/lf-file-service-upload-client.git'
解决方法:经检查发现,本人git账号角色为developer,无法提交代码到master分支,使用其他人的master账号将自己的账号角色改为master即可。
error 2、
! [rejected] master -> master (fetch first)error: failed to push some refs to 'https://gitee.com/aaaa/vue-admin-master.git'
解决方法:push后添加“-f”,即第7步改为git push -f origin master
error 3、
! [rejected] master -> master (non-fast-forward)error: failed to push some refs to 'https://gitee.com/aaaa/vue-admin-master.git'
解决方法:出现这个问题的原因是git认为远程仓库的项目和本地仓库的项目是两个不同的项目,要把两个不同的项目合并,不能简单的git pull,要使用
git pull origin master --allow-unrelated-histories
表示强制把不同的项目合并,然后再执行第7步就可以了。
转载地址:https://blog.csdn.net/qq_39387856/article/details/85342498 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
哈哈,博客排版真的漂亮呢~
[***.90.31.176]2024年04月21日 02时02分54秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
关于iOS XCode的entitlements文件
2021-06-30
Airtest自动化测试神器,教你实现Unity自动化测试
2021-06-30
模拟器连接端口汇总和常用ADB命令
2021-06-30
ShaderGraph使用教程与各种特效案例:Unity2020(持续更新)
2021-06-30
Unity爆炸、闪电、火焰、雷雨特效Demo
2021-06-30
使用python登录和访问Confluence
2021-06-30
Unity2020中使用MemoryProfile卡死和报错的问题
2021-06-30
Unity中加载Texture2D不断消耗内存的问题
2021-06-30
手把手教你使用Unity制作一个飞机喷射火焰尾气的粒子效果
2021-06-30
gitee使用教程,创建项目仓库并上传代码
2021-06-30
Unity3D 上传日志
2021-06-30
Unity3D 序列帧
2021-06-30
Unity3D 动态创建图集并压入精灵(NGUI)
2021-06-30
C# 将Excel转xml
2021-06-30
Unity3D log写入文件
2021-06-30
Unity3D动态创建摄像机
2021-06-30
unity 根据纪元时间(1970/1/1)转换为DateTime
2021-06-30