玩转GIT系列之【git submodule update出错提示子模组未对路径注册】
今天在github上找到了一個很有意思的項目,叫做listen1【https://github.com/listen1】,它是一個開源的項目,可以從各大音樂網站自動化搜索歌曲、避免某個特定的網站因為版權問題而無法聽歌,超級實用(這里先給作者點個贊,打個小廣告)。下面摘自作者的原文:
當我發現找個想聽的歌因為版權聽不了,需要打開好幾個網站開始搜索,來回切換讓我抓狂的時候,我知道是時候該做點什么了。
媽媽再也不用擔心我找不到我想聽的歌了。這里包含了網易云音樂,蝦米,QQ音樂, 酷狗音樂,酷我音樂的曲庫,夠全夠大了吧。
搜歌,聽歌,就用 Listen1。
于是嘗試將它的源碼clone下來學習學習??墒莄lone下來之后,看到一個提示信息,說:
項目中包含了listen1_chrome_extension的引用,在checkout后需要把引用庫初始化
git submodule update --init --recursive
于是,執行。
可是,出錯:
leon@Ubuntu:~/studytest/listen1_desktop$ git submodule update --init --recursive 子模組 'app/listen1_chrome_extension' (git@github.com: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: 無法克隆 'git@github.com:listen1/listen1_chrome_extension.git' 到子模組路徑 'app/listen1_chrome_extension'于是開始百度“git submodule”相關的各類博文,卻始終沒有發現一個對路的解決辦法,大多數人都是拷貝、復制、黏貼、轉發別人的博文,沒有什么參考意義。
終于,歷經千辛萬苦(略有夸張哈哈),在一位大神的博客里找到了成功的解決方案:
因為我使用的git url格式與原項目下的.gitmodule文件中的url格式不對,它寫的是git格式,而我使用的是https的格式。
按照以下方法更換一下即可:
vi .gitmodules將下面的原文:
[submodule "app/listen1_chrome_extension"]path = app/listen1_chrome_extensionurl = git@github.com:listen1/listen1_chrome_extension.git修改成:
[submodule "app/listen1_chrome_extension"]path = app/listen1_chrome_extensionurl = https://github.com/listen1/listen1_chrome_extension.git修改完后,再次執行:
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: 無法克隆 'git@github.com:listen1/listen1_chrome_extension.git' 到子模組路徑 'app/listen1_chrome_extension'腫么還是出錯!!!!????
淡定淡定,再來分析。原來是子模塊的url沒有同步修改,于是執行下面的命令:
leon@Ubuntu:~/studytest/listen1_desktop$ git submodule sync 為 'app/listen1_chrome_extension' 同步子模組 url最后再來:
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'終于成功了!!!
總結
以上是生活随笔為你收集整理的玩转GIT系列之【git submodule update出错提示子模组未对路径注册】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Win10怎么重建图标缓存 Win10重
- 下一篇: 基于OpenCV的摄像头视频录制保存工具