在Post Step中使用相同的http git凭证作为Shell脚本中的克隆 [英] Use same http git credentials as for cloning in a Shell script in a Post Step
问题描述
我想让我们的发布过程自动化,并且我有一个关于Maven项目的Jenkins构建作业:
如果我运行版本,在执行我的 Post Step Shell脚本时收到以下错误:
fatal:无法读取'https:// mygitserver'的用户名:输入/输出错误
code>
Git Repo服务器使用HTTP进行身份验证。
日志我可以看到Jenkins使用.gitcredentials处理身份验证:使用.gitcredentials设置凭据
$ b
git config --local credential.username jenkins#timeout = 10
> git config --local credential.helper store --file = / tmp / git2442727044778485.credentials#timeout = 10
我现在想要重新使用这些凭证存储,因为它们是在我的构建开始时创建的,但在克隆后又被删除。
这是可能的吗?我需要自己用Credentials Binding Plugin等来处理这个问题吗?
感谢您的帮助。
I want to automate our Release process and I have a following Jenkins build job for a Maven project:
- Cloning a Git repo with configured Jenkins Credentials (username/password)
- Executing some Maven commands for the build
- Having a Post Step configured which executes some additional Git commands: merge, tag, push
If I run the build I receive following error during executing my Post Step Shell script:
fatal: could not read Username for 'https://mygitserver': Input/output error
The Git Repo server uses HTTP for Authentication.
In the Console Log I can see that Jenkins uses .gitcredentials to handle the Authentication:
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
I would like now to reuse actually these credential store because they are created at the beginning of my build, but are removed again after cloning.
Is this somehow possible or do I need to handle this somehow by myself with the "Credentials Binding Plugin", etc.?
Thanks for your help.
Because I haven't found yet any solution to reuse the initial Git credentials from the clone command at the beginning of my build, I have just used now the Jenkins Credentials Binding plugin and created a own credentials store for my custom git commands in the Post Step.
这篇关于在Post Step中使用相同的http git凭证作为Shell脚本中的克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!