玩转GIT系列之【git submodule update出错提示子模组未对路径注册】

摘自:https://blog.csdn.net/leon1741/article/details/90259836

玩转GIT系列之【git submodule update出错提示子模组未对路径注册】

leon1741 2019-05-16 11:15:15 11117 收藏 7

分类专栏: 玩转GIT 文章标签: git

版权

今天在github上找到了一个很有意思的项目,叫做listen1【https://github.com/listen1】,它是一个开源的项目,可以从各大音乐网站自动化搜索歌曲、避免某个特定的网站因为版权问题而无法听歌,超级实用(这里先给作者点个赞,打个小广告)。下面摘自作者的原文:

当我发现找个想听的歌因为版权听不了,需要打开好几个网站开始搜索,来回切换让我抓狂的时候,我知道是时候该做点什么了。
妈妈再也不用担心我找不到我想听的歌了。这里包含了网易云音乐,虾米,QQ音乐, 酷狗音乐,酷我音乐的曲库,够全够大了吧。
搜歌,听歌,就用 Listen1。

于是尝试将它的源码clone下来学习学习。可是clone下来之后,看到一个提示信息,说:

项目中包含了listen1_chrome_extension的引用,在checkout后需要把引用库初始化
git submodule update --init --recursive

于是,执行。

可是,出错:

leon@Ubuntu:~/studytest/listen1_desktop$ git submodule update --init --recursive
子模组 'app/listen1_chrome_extension' ([email protected]:listen1/listen1_chrome_extension.git) 未对路径 'app/listen1_chrome_extension' 注册
正克隆到 'app/listen1_chrome_extension'...
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: 无法克隆 '[email protected]:listen1/listen1_chrome_extension.git' 到子模组路径 'app/listen1_chrome_extension'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

于是开始百度“git submodule”相关的各类博文,却始终没有发现一个对路的解决办法,大多数人都是拷贝、复制、黏贴、转发别人的博文,没有什么参考意义。

终于,历经千辛万苦(略有夸张哈哈),在一位大神的博客里找到了成功的解决方案:

因为我使用的git url格式与原项目下的.gitmodule文件中的url格式不对,它写的是git格式,而我使用的是https的格式

按照以下方法更换一下即可:

vi .gitmodules
  • 1

将下面的原文:

[submodule "app/listen1_chrome_extension"]
    path = app/listen1_chrome_extension
    url = [email protected]:listen1/listen1_chrome_extension.git
  • 1
  • 2
  • 3

修改成:

[submodule "app/listen1_chrome_extension"]
    path = app/listen1_chrome_extension
    url = https://github.com/listen1/listen1_chrome_extension.git
  • 1
  • 2
  • 3

修改完后,再次执行:

leon@Ubuntu:~/studytest/listen1_desktop$ git submodule update --init --recursive
正克隆到 'app/listen1_chrome_extension'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: 无法克隆 '[email protected]:listen1/listen1_chrome_extension.git' 到子模组路径 'app/listen1_chrome_extension'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

肿么还是出错!!!!????

淡定淡定,再来分析。原来是子模块的url没有同步修改,于是执行下面的命令:

leon@Ubuntu:~/studytest/listen1_desktop$ git submodule sync
为 'app/listen1_chrome_extension' 同步子模组 url
  • 1
  • 2

最后再来:

leon@Ubuntu:~/studytest/listen1_desktop$ git submodule update --init --recursive
正克隆到 'app/listen1_chrome_extension'...
remote: Enumerating objects: 45, done.
remote: Counting objects: 100% (45/45), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 899 (delta 20), reused 24 (delta 11), pack-reused 854
接收对象中: 100% (899/899), 1.00 MiB | 322.00 KiB/s, 完成.
处理 delta 中: 100% (587/587), 完成.
检查连接... 完成。
子模组路径 'app/listen1_chrome_extension':检出 '0af87e6b028a1ac2f544b74aca1824b2cef66880'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

终于成功了!!!

猜你喜欢

转载自blog.csdn.net/sinat_16643223/article/details/113076033