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 initSubmodule '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子模块那么, ...
随机推荐
- 第二章:在HTML中使用JavaScript
1:在使用<script>嵌入JavaScript代码死,记住不要在代码中的任何地方出现"</script>"字符串 例如,浏览器在加载下面所示代码时就会产 ...
- Linux驱动技术(一) _内存申请
先上基础,下图是Linux的内存映射模型,其中体现了Linux内存映射的几个特点: 每一个进程都有自己的进程空间,进程空间的0-3G是用户空间,3G-4G是内核空间 每个进程的用户空间不在同一个物理内 ...
- Sqlite 帮助类 SQLiteHelper
///源码下载地址:http://download.csdn.net/detail/kehaigang29/8836171 ///dll下载地址:http://download.csdn.net/de ...
- JavaScript中数组Array方法详解
ECMAScript 3在Array.prototype中定义了一些很有用的操作数组的函数,这意味着这些函数作为任何数组的方法都是可用的. 1.Array.join()方法 Array.join()方 ...
- WebSocket浅析(一):实现群聊功能
首先WebSocket打破了传统的web请求响应模式,实现管道式的实时通信,并且可以持续连接. 相对于传统 HTTP 每次请求-应答都需要客户端与服务端建立连接的模式,WebSocket 是类似 So ...
- hibernate系列笔记(3)---持久化对象
持久化对象 再讲持久化对象之前,我们先来理解有关session中get方法与 load方法区别: 简单总结: (1)如果你使用load方法,hibernate认为该id对应的对象(数据库记录)在数据库 ...
- 每天一个linux命令(39)--ifconfig命令
许多人非常熟悉Windows下的ipconfig 命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config ...
- php实现留言板功能
这个小小的留言板功能适合班级内或者公司内部之间的讨论,对话和留言,非常的方便,更重要的是无需网络,对于公司管理层来说是非常乐于常见的, 下面是这个留言板的写法: 1 首先是登录页面: <form ...
- 读阮一峰对《javascript语言精粹》的笔记,我有疑问。
<javascript语言精粹>是一本很棒的书籍,其中作者在附录列出了12种他所认为的javascript语言中的糟粕. 我最近开始跟读前端前辈的博客,其中读到了阮一峰的<12种不宜 ...
- Android学习总结(十二)———— BaseAdapter优化
一.BaseAdapter的基本概念 对于Android程序员来说,BaseAdapter肯定不会陌生,灵活而优雅是BaseAdapter最大的特点.开发者可以通过构造BaseAdapter并搭载到L ...