git submodule 使用过程中遇到的问题
git submodule 使用过程中遇到的问题
资源文件
原.gitmodules文件的内容如下:
[submodule "Submodules/FFmpegWrapper"]
path = Submodules/FFmpegWrapper
url = git@github.com:OpenWatch/FFmpegWrapper.git
[submodule "Submodules/CocoaHTTPServer"]
path = Submodules/CocoaHTTPServer
url = git@github.com:robbiehanson/CocoaHTTPServer.git
[submodule "Submodules/OWS3Client"]
path = Submodules/OWS3Client
url = git@github.com:OpenWatch/OWS3Client.git
[submodule "Submodules/SSKeychain"]
path = Submodules/SSKeychain
url = git@github.com:soffes/sskeychain.git
[submodule "Submodules/CocoaLumberjack"]
path = Submodules/CocoaLumberjack
url = git@github.com:CocoaLumberjack/CocoaLumberjack.git
[submodule "Submodules/AFNetworking"]
path = Submodules/AFNetworking
url = git@github.com:AFNetworking/AFNetworking.git
[submodule "Submodules/AFOAuth2Client"]
path = Submodules/AFOAuth2Client
url = git@github.com:AFNetworking/AFOAuth2Client.git
步骤
1、首先我们clone一下目标工程,然后进入工程目录
git submodule init
Submodule 'Submodules/AFNetworking' (git@github.com:AFNetworking/AFNetworking.git) registered for path 'Submodules/AFNetworking'
Submodule 'Submodules/AFOAuth2Client' (git@github.com:AFNetworking/AFOAuth2Client.git) registered for path 'Submodules/AFOAuth2Client'
Submodule 'Submodules/CocoaHTTPServer' (git@github.com:robbiehanson/CocoaHTTPServer.git) registered for path 'Submodules/CocoaHTTPServer'
Submodule 'Submodules/CocoaLumberjack' (git@github.com:CocoaLumberjack/CocoaLumberjack.git) registered for path 'Submodules/CocoaLumberjack'
Submodule 'Submodules/FFmpegWrapper' (git@github.com:OpenWatch/FFmpegWrapper.git) registered for path 'Submodules/FFmpegWrapper'
Submodule 'Submodules/OWS3Client' (git@github.com:OpenWatch/OWS3Client.git) registered for path 'Submodules/OWS3Client'
Submodule 'Submodules/SSKeychain' (git@github.com:soffes/sskeychain.git) registered for path 'Submodules/SSKeychain'
2、接下来我们尝试更新子模块
git submodule update --init --recursive
$ git submodule update --init --recursive
Cloning into '/Users/macmini_35/Downloads/FFmpeg-iOS-Encoder/Submodules/AFNetworking'...
Permission denied (publickey).
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
fatal: clone of 'git@github.com:AFNetworking/AFNetworking.git' into submodule path 'filepath/FFmpeg-iOS-Encoder/Submodules/AFNetworking' failed
3、删除子模块,重新添加子模块
1、由于平常用到的git命令很少,于是乎我去查了一下命令(不截图了)
Fails with error: 'fatal: Please, stage your changes to .gitmodules or stash them to proceed' This appears to be rather outdated. The current correct procedure: git submodule deinit <name>
git rm --cached <name>
rm -rf .git/modules/<name>
From: http://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule
这个结果在github上边找到的,然后根据后边的链接跳到了stackoverflow,这里只有一部分请自行前往浏览完整篇;
There was no Porcelain way to say "I no longer am interested in this submodule",once you express your interest in a submodule with "submodule init".
"submodule deinit" is the way to do so.
The deletion process also uses git rm (since git1.8.5 October 2013). Summary The all removal process would then be: mv asubmodule asubmodule_tmp
git submodule deinit asubmodule
git rm asubmodule
# Note: asubmodule (no trailing slash)
# or, if you want to leave it in your working tree
git rm --cached asubmodule
mv asubmodule_tmp asubmodule
But you seem to still need a:
rm -rf .git/modules/asubmodule
嗯!开始尝试
*$ git submodule deinit Submodules/AFNetworking
Submodule 'Submodules/AFNetworking' (git@github.com:AFNetworking/AFNetworking.git) unregistered for path 'Submodules/AFNetworking'
*$ git rm Submodules/AFNetworking
rm 'Submodules/AFNetworking'
*$ git rm --cached Submodules/AFNetworking
fatal: pathspec 'Submodules/AFNetworking' did not match any files
*$ git submodule add https://github.com/AFNetworking/AFNetworking.git Submodules/AFNetworking
Cloning into '/Users/macmini_35/Downloads/FFmpeg-iOS-Encoder/Submodules/AFNetworking'...
remote: Counting objects: 14512, done.
remote: Total 14512 (delta 7), reused 7 (delta 7), pack-reused 14504
Receiving objects: 100% (14512/14512), 5.17 MiB | 1.83 MiB/s, done.
Resolving deltas: 100% (9552/9552), done.
Checking connectivity... done.
备注:
**请一定要按照顺序操作啊!本来都已经完事了,就是因为顺序错了搞得有重来了一次**
- git submodule deinit
submodulename
- git rm
submodulename
- git rm --cached
submodulename
- rm -rf ./git/modules/
submodulename
这一步是针对已经update之后的子模块删除的
git submodule 使用过程中遇到的问题的更多相关文章
- gitlab使用过程中的需求与解决
序言 在git使用过程中发现指令实在太多,就算记忆后不长用的话很快也会忘记掉,所以编写本文的初衷是为了记录在使用git指令的过程中所遇到的需求与解决方法,毕竟使用git的需求也就那么一些,范围不大,所 ...
- 开发与测试整体过程中的Git分支merge流程
开发与测试整体过程中的Git分支merge流程 Git分支merge之开发流程 首先在Gitlab上有个仓库存储着原始的项目代码,其中包含一个叫master的分支.然后可能按功能进行分配,由不同的开发 ...
- Git使用过程中出现项目文件无法签入Source Control的情况
在VS中使用Git进行项目source control的过程中,有些文件不在source control之下,右键点击时,也找不到Undo, Commit命令 无法把他们签入进Source Contr ...
- [Git]07 如何在提交过程中忽略某些文件
一般我们总会有些文件无需纳入 Git 的管理,也不希望它们总出现在未跟踪文件列表.通常都是些自动生成的文件,比如日志文件,或者编译过程中创建的临时文件等.我们可以创建一个名为 .gitignor ...
- Git submodule 仓库中包含另外的仓库(子仓库)
Git submodule 仓库中包含另外的仓库(子仓库) 添加 submodule 在父仓库 git 目录下: git submodule add ssh://ip/[path]/xxx.git 注 ...
- git rebase 过程中遇到冲突该怎么解决?
在执行git rebase 过程中经常遇到问题,此时有点慌,一般如何解决呢? 1.先将本地的冲突手动解决 2.执行下面命令 git add . git rebase --contine //继续re ...
- git提交过程中遇到的 index.lock 问题导致无法提交的解决方法
在提交代码的过程中,可能会遇到下面的问题: fatal: Unable to create 'C:/programLists/zzw-q1/.git/index.lock': File exists. ...
- 在SourceTree中使用Git submodule
在開發的過程中我們的項目可能會引用其他的版本庫中的代碼, 例如公司已經累積了一套公用的函式庫, 被多個項目調用; 很顯然地, 不能把公用函式庫的文件直接放到我們開發中的項目中, 這樣不但項目的冗餘, ...
- git submodule初用
git submodule主要是用于针对git项目中还存在git子模块的情况.在一般情况下,我们通过git clone 获取项目的时候会把项目中的所有信息都拿到.但是,如果相关中存在git子模块那么, ...
随机推荐
- [Bullet3]常见物体和初始化
官方文档:http://bulletphysics.org 开源代码:https://github.com/bulletphysics/bullet3/releases API文档:http://bu ...
- db2_merge
DB2 MERGE INTO语句的使用 DB2中的Merge语句可以将一个表中的数据合并到另一个表中,在合并的同时可以根据条件进行插入.删除.更新等操作,功能非常强大. 语法如下:www.2c ...
- Python学习--17 进程和线程
线程是最小的执行单元,而进程由至少一个线程组成.如何调度进程和线程,完全由操作系统决定,程序自己不能决定什么时候执行,执行多长时间. 进程 fork调用 通过fork()系统调用,就可以生成一个子进程 ...
- shell脚本,符号
在shell中常用的特殊符号罗列如下: # ; ;; . , / \\ 'string'| ! $ ${} $? $$ $* \"string\"* ** ...
- java udp socket通信(仅发送)
实现功能:客户端发送一个字符串(可以为汉字),服务器端接收并显示 服务器端程序: package udpServer; import java.io.*; import java.net.*; /** ...
- nginx配合IIS实现简单负载均衡
1.IIS 部署两个站点端口分别为8081和8082 8081站点和8082站点如下[随便写了个没有样式的很丑的页面],我特意加了111和222区分 2.设置nginx配置文件,实现简单的负载 ...
- php测试题 知识点整理
1 SQL语句的整理: insert into+表名+values +(添加的内容 ) 例: insert into users values ('p001','张三','男'); 修改: upd ...
- [Hadoop] - TaskTracker源码分析(状态发送)
TaskTracker节点向JobTracker汇报当前节点的运行时信息时候,是将运行状态信息同心跳报告一起发送给JobTracker的,主要包括TaskTracker的基本信息.节点资源使用信息.各 ...
- [UWP]附加属性2:实现一个Canvas
5. 附加属性实践:自定义Canvas 附加属性在UWP中是一个十分重要的组成部分,很多功能都依赖于附加属性实现,典型的例子是常用的Grid和Canvas.通常附加属性有三个使用场景:插入属性.触发行 ...
- 设计理念 : popup login 在前后台
popup 意思是一个遮罩层顶在整个网页最前方,在前台设计是这样的,当用户想在那个界面登入时,就可以有一个遮罩层出现. 在employer或admin(后台)操作界面是同个理念,在所有的界面都是有co ...