簡體   English   中英

Git 子模塊 - 無法使用 Linux Windows 子系統訪問存儲庫

[英]Git Submodule - Unable to Access Repository using Linux Subsystem for Windows

我正在嘗試將 Git 子模塊添加到不同的存儲庫。 我創建了我想要的存儲庫,但子模塊是由我的顧問創建的。

為方便起見,假設我要添加的子模塊是存儲庫 A,而我要添加的子模塊是存儲庫 B。

幾點注意事項:

  1. 我正在為 Windows 使用 Linux 子系統(即 Ubuntu 終端應用程序)。
  2. 我有一個活躍的互聯網連接,可以通過標准的 git 命令(git pull、push、commit 等)訪問兩個存儲庫
  3. 我可以使用指向 A 的符號鏈接讓我的所有代碼正常工作。

這是我將 A 添加到 B 以及相應的終端輸出所采取的步驟。

In: git submodule add git@gitlab.com:Respository_B

上面的行工作正常,我可以在 .gitmodules 文件中看到正確的信息,這是 output:

[submodule "Repository_B"]       
    path = repository_B
    url = git@gitlab.com:Repsitory_B

現在,我嘗試了以下兩件事:

In: git submodule init
Out: fatal: No url found for submodule path 'submodule_A' in .gitmodules

和,

In: git submodule update --remote
Out: setsockopt IPV6_TCLASS 8: Operation not permitted: 

我難住了。 我嘗試在網上搜索解決方案,但空手而歸。 有想法該怎么解決這個嗎?

另外,如果我需要澄清任何事情,請告訴我。

謝謝!


編輯


剛剛讀到Windows 子系統存在一些 chmod 問題,所以我嘗試了這一行並得到了不同的錯誤消息。

In:  sudo git submodule update --remote 
Out: git@gitlab.com: Permission denied (publickey). 
     fatal: Could not read from remote repository. 

     Please make sure you have the correct access rights
     and the repository exists.
     Unable to fetch in submodule path 'Repository_A'

這很奇怪,因為我可以使用指向本地克隆的符號鏈接來訪問存儲庫。

我正在嘗試添加的是存儲庫 A,而我嘗試將其添加到的是存儲庫 B。

那么命令將是:

cd /path/to/B
git submodule add git@gitlab.com:Respository_A
git commit -m "Add A to B"
git push

關於錯誤消息, 此問題表明:

我們正在使用的解決方法是將以下行放在 ~/.ssh/config 中:

 AddressFamily inet

注意:如果您要連接到 IPv4 主機,則使用 AddressFamily inet 效果很好。 如果主機僅為 IPv6,則根本無法連接。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM