git - 如何在不要求每个子存储库的密码的情况下使用子模块克隆 git 存储库
问题描述
我最近将一个存储库放入 bitbucket。这个存储库有一些子模块
我正在编写一个初始化脚本。我想克隆主目录,然后他们拉出所有子目录。
git clone https://bitbucket.org/#####/main.git elastic --recurse-submodules
这会提示我输入用户名和密码。
Username for 'https://bitbucket.org': myuser
Password for 'https://myuser@bitbucket.org':
他们再次向我询问每个子模块
Username for 'https://bitbucket.org':
...
我的 .gitmodules 文件是这样的:
[submodule "api"]
path = app/api/
url = git@bitbucket.org/###/api.git
branch = master
[submodule "front"]
path = app/front
url = git@bitbucket.org/###/front.git
branch = master
[submodule "app/config"]
path = app/config
url = git@bitbucket.org/###/config.git
branch = master
... some few more repositories
如何克隆主存储库,并且它们对所有子存储库使用相同的凭据?
我正在使用 AWS AMI Linux。
解决方案
设置 git 以使用凭证内存缓存解决了我的问题
git config --global credential.helper cache
这足以使用相同的用户/密码提取所有回购
如果我想一整天保持相同的缓存,我可以将时间设置为更长的时间跨度:
git config --global credential.helper 'cache --timeout=86400'
86400 秒 = 1 天;
推荐阅读
- node.js - 我可以在 redux 商店中存储 socket.io 套接字吗?(并调用它的函数)
- mysql - MySQL:创建函数、执行语句和删除函数
- ios - 使用 Apple Watch 混合音频
- swiftui - SwiftUI - 尝试从不同的视图重新运行一个类以强制重新加载数据
- python-3.x - 如何在嵌套数据上访问 RPyC 中的公共属性?
- c# - FluentValidator 如何确定默认使用的显示名称?
- model-view-controller - Microsoft Azure Speech-to-Text MVC 应用程序
- python - 无法删除日期列 KeyError: "['Date'] not found in axis
- docker - Traefik - 转发到外部 IP
- download - AppleScript - 复制文件夹内容显示错误 - 下载和解压缩作品