由于公司要求,需要把旧的项目迁移到新的gitlab地址上,这好办,只需要改下remote repository url就可以了,如果仓库中用到子模块,还需要顺便更新子模块的url。

不过,本地是编译通过了,但是推送到远程后,gitlab CI编译时会报错如下:

fatal: Needed a single revision
Unable to find current origin/HEAD revision in submodule path

网上也能搜到相同的问题,但是没有一个是在gitlab CI上遇到这个问题的,他们的解决方法存在一些问题,在gitlab CI上仍然会报相同的错误。

后面经过几天的摸索,终于找到正确的解决方法。

  1. 移除子模块
git rm <submodulePath>

注意需要使用git rm命令来删除子模块,这样.gitmodules下的相关信息也能一并删除。

  1. 提交删除更改
git commit -m "remove submodule"
  1. 重新添加子模块
git submodule add <url> <path>
  1. 提交添加子模块更改
git commit -m "add submodule"

这时候再看gitlab CI,就不会再报这个错误了。

Git error-fatal-Needed a single revision相关推荐

  1. fatal: Needed a single revision, invalid upstream “xxxx“ 问题解决

    在日常使用 git 的时候,使用 git rebase 或者其他 git 命令操作分支的时候可能会遇到如下问题: 使用命令: git rebase branch_name 得到错误: fatal: N ...

  2. fatal: Needed a single revision和Unable to find current revision in submodule path解决办法

    当执行 git submodule update 遇见问题 fatal: Needed a single revision Unable to find current revision in sub ...

  3. 解决 fatal: unable to access ‘https://github.com/qweertu/git-demo.git/‘: error setting certificate...

    git push 时出现错误  fatal: unable to access 'https://github.com/qweertu/git-demo.git/': error setting ce ...

  4. 关于git的fatal: unable to access ‘https://gitee.com/‘: Could not resolve host: gitee.com; Unknown error

    关于GIT 的 fatal: unable to access 'https://gitee.com/项目名称/ceshi.git/': Could not resolve host: gitee.c ...

  5. git pull fatal: refusing to merge unrelated histories

    1.首先我github有个远程仓库,然后我本地有个仓库 本地仓库我新添加了一个文件,然后我去关联(git remote add origin git@github.com:qshilary/gitte ...

  6. npm ERR! code 128npm ERR! An unknown git error occurrednpm ERR! command git --no-replace-objects l

    背景: 在安装vue-element-admin 项目所需依赖时,出现了如下报错信息 npm ERR! code 128 npm ERR! An unknown git error occurred ...

  7. 【git】fatal: in unpopulated submodule

    为了直接编译go代码,把依赖库放common下了. 然后, 把下载回来的git 代码上传了 怎么才能 直接上传代码呢? 直接add报错:fatal: in unpopulated submodule ...

  8. Error:The SDK Build Tools revision (23.0.3) is too low for project ':app'. Minimum required is 25.0.

    导入github上项目的时候出现 Error:The SDK Build Tools revision (23.0.3) is too low for project ':app'. Minimum ...

  9. git错误fatal: remote origin already exists.

    输入 $git remote add origin https://github.com/用户名/项目.git,提示fatal: remote origin already exists.  解决办法 ...

最新文章

  1. 6.MATLAB变量——矩阵操作一
  2. [学习笔记]树链剖分
  3. JavaScript中带示例的String repeat()方法
  4. 依赖注入(Dependency Injection)框架是如何实现的?
  5. 高斯09linux教程,Gaussian 09的安装与使用
  6. 1024,错过这一波福利,又要等一年了!
  7. Python调用pywin32模拟触屏滑动 刷宝视频,自动刷视频python
  8. 解Invalid character found in the request target.
  9. 语音短时过零率计算——Python实现
  10. cobol .cpy文件_Visual COBOL R3:“使传统的COBOL能够部署在JVM或.NET上”。
  11. Java Netty长连接实现Android推送
  12. Windows下Idea,AndroidStudio的字体美化
  13. 关于Python 统计出log文件 各个类型的大小总和
  14. python做性能测试框架_python常用web框架简单性能测试结果分享(包含dja
  15. ToDesk安装与使用
  16. 区别 |Python的 open() 和with open() as
  17. 洛谷—P1417 烹调方案(背包问题)
  18. HTML 鼠标点击复制元素内容
  19. 电脑充电和电池保养的标准答案
  20. 面对质疑,统一操作系统UOS竟然这样回应!

热门文章

  1. RTKLIB软件源码学习(Kalman滤波最小二乘)
  2. IDEA界面字体过大
  3. Java 比较两个日期的先后
  4. 控温仪的工作原理介绍
  5. 数学建模 --- 蒙特卡洛模拟使用的一些函数
  6. Linux rzsz命令
  7. 3个图片翻译方法分享,多国语言任你挑,千万别错过!
  8. 烫烫烫”和“屯屯屯”
  9. 什么是高内聚,低耦合?
  10. 身份证过期了,补办的身份证还没拿到,可以参考全国计算机等级考试吗?