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.?
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.
Here is a path I took in order to fulfil a similar need: