Jenkins中使用git submodule时报fatal: could not read Username for ‘xxxx‘: No such device or address的解决方案
【代码】Jenkins中使用git submodule时报fatal: could not read Username for 'xxxx': No such device or address的解决方案。
·
如题所述,博主最近想在Jenkins中自动化部署gitlab项目,但是在Jenkins中的shell脚本执行git submodule时报:
fatal: could not read Username for ‘xxxx’: No such device or address

本质原因是 服务器没有权限去拉取git子库,有如下几种解决方案:
- 将服务器的公钥配置到gitlab中,但这样服务器上的所有人都能clone你的代码
- 将username和password配置到服务器中,存在同样的问题
- 将gitlab的子仓库设置成public,这相当于裤衩都被脱掉了。。。
- 使用高级子模块克隆功能,可以完美解决这个问题
我们使用第4种方案解决这个问题,
设置步骤如下:
- 在Configure中添加
Additional Behaviours项
- 点击
Add后选择Advanced sub-modules behaviours高级子模块行为
- 勾选
Use credentials from default remote of parent repository使用来自父存储库的默认远程的凭据
- Save并Apply,即可解决问题。
参考文献:
更多推荐
所有评论(0)