git - 避免为每个子模块重新输入密码

标签 git git-submodules

我有一个包含 3 个子模块的存储库。 repo 和子模块都在同一台服务器上,我可以通过 ssh 访问它。远程 URL 是:

ssh://mm@theserver.com/path/to/sub1.git
ssh://mm@theserver.com/path/to/sub2.git
ssh://mm@theserver.com/path/to/sub3.git

如果我执行诸如 git submodule update --remote 之类的操作,它会提示我输入密码 3 次。

有什么方法可以更新子模块但只需要密码一次吗?提交更改等也是如此。

最佳答案

减少头痛的解决方案

另一种方法是使用内置的 git cache (需要 1.7.10 或更高版本)所以 git 会在您第一次提供后记住您的登录名和密码。

启用默认超时(15 分钟)的 git 缓存

git config --global credential.helper cache

更改默认超时类型

git config --global credential.helper 'cache --timeout=3600'

关于git - 避免为每个子模块重新输入密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30180751/

相关文章:

git - 是否可以添加/启动一个新的 git 子模块并将忽略选项设置为某个值?

git - 我如何在一行中对所有子模块进行 git clone --recursive 和 checkout master?

Github:在两个标签之间列出 PR

cmake - 可选的 add_subdirectory(如 find_package)

git submodule update --remote 不起作用

git - 如何在不初始化子模块的情况下对所有子模块执行 `git pull`

git - 如何获取 `git clone --recursive` 以重新创建子模块的 Remote 和分支?

git - 推送到不同的 git repo

linux - 当我尝试添加一个文件名在 Windows 上无效的文件时,我可以让 git 警告我吗?

git svn 工作流程 - 功能分支和 merge