使用访问令牌递归地从GitHub克隆子模块

4

我有一个包含多个子模块的仓库。我正在使用

git clone --recurse-submodules --remote-submodules https://<access_token>@github.com/user/repo.git

为了递归地克隆所有子模块,在Ubuntu上,我被要求为每个子模块提供凭据,尽管它们都可以使用相同的访问令牌访问,我已通过单独克隆它们进行了测试。顺便说一下:自8月13日以来,GitHub不再接受用户名和密码。
在安装了Visual Studio的Windows上,只需为总体存储库提供一次访问令牌即可。
我已经尝试使用Git凭据缓存,但没有起作用。
git config --global credential.helper cache

如何仅提供一次访问令牌就可以递归地克隆子模块?

1个回答

4

你可以做到

git config --system credential.helper store
echo "https://username:token@github.com" > ~/.git-credentials
git clone --recurse-submodules https://github.com/org/repo repo

现在从github.com克隆主要仓库和子模块将使用此令牌。

子模块仍然没有使用令牌。 - Nikhil Popli

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接