github 代码空间上的 git 子模块

Mag*_* Bo 7 git github codespaces

我对 github 代码空间上的子模块有疑问。

当我使用命令时

git submodule update --init
Run Code Online (Sandbox Code Playgroud)

终端显示给我

Warning: Permanently added 'github.com,xxxxx' (ECDSA) to the list of known hosts.
    git@github.com: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
Run Code Online (Sandbox Code Playgroud)

art*_*nrq 1

Github Codespace 管理他们所谓的开发者容器,它提供了一个功能齐全的开发环境。每当您在代码空间中工作时,您都在虚拟机上使用开发容器。

文档来看:

默认情况下,您的代码空间被分配一个令牌,该令牌的范围具有创建它的存储库的read权限或read和权限write

如果您的项目需要其他存储库的附加权限,您可以在文件中进行配置,如“设置附加存储库权限devcontainer.json中所述

要设置给定存储库的所有权限,请在存储库对象(文件)中使用"permissions": "read-all"或:"permissions": "write-all".devcontainer.json

// .devcontainer.json
{
  "customizations": {
    "codespaces": {
      "repositories": {
        "my_org/my_repo": {
          "permissions": "write-all"
        }
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

因此,通过该.devcontainer文件,我们可以设置一个特定的存储库开发容器,以获得拉动和推送其项目子模块存储库所需的授权!