相关疑难解决方法(0)

使用与后期步骤中的 Shell 脚本中的克隆相同的 http git 凭据

我想要自动化我们的发布过程,并且我有一个 Maven 项目的以下 Jenkins 构建作业:

  • 使用配置的 Jenkins 凭证(用户名/密码)克隆 Git 存储库
  • 执行一些 Maven 命令以进行构建
  • 配置一个后步骤来执行一些额外的 Git 命令:合并、标记、推送

如果我运行构建,我在执行Post Step Shell 脚本期间会收到以下错误:

fatal: could not read Username for 'https://mygitserver': Input/output error
Run Code Online (Sandbox Code Playgroud)

Git Repo 服务器使用 HTTP 进行身份验证。

在控制台日志中,我可以看到 Jenkins 使用 .gitcredentials 来处理身份验证:

using .gitcredentials to set credentials
> git config --local credential.username jenkins # timeout=10
> git config --local credential.helper store --file=/tmp/git2442727044778485.credentials # timeout=10
Run Code Online (Sandbox Code Playgroud)

我现在想实际上重用这些凭证存储,因为它们是在构建开始时创建的,但在克隆后再次删除。

这是否可能,或者我是否需要自己使用“凭据绑定插件”等以某种方式处理这个问题?

git shell credentials jenkins

5
推荐指数
1
解决办法
8147
查看次数

标签 统计

credentials ×1

git ×1

jenkins ×1

shell ×1