brenuart thank you very much! It seems a more appropriate way than trying to inject a SSH key with sshagent(...).
There is still one question about reusing the credentials: imagine the user "Thomas" creates a pipeline within Jenkins with his GitHub credentials to access the repository, to build my project I need to pull X dependencies with some from private repositories. If the user "Thomas" doesn't have access to all these private repositories it will fail... That's the same if "Thomas" leaves the company, we should delete all his pipelines and recreate them, no? The workaround I think about is either to use SSH key able to access all private repositories (that's why I was trying to use sshagent(...) ), or to create a dedicated "Jenkins" user to create new pipeline. With a dedicated user I'm sure it will persist over time and that it has access to all private repositories. Which way did you choose?
(For your information: I'm using Jenkins Blue Ocean)
By the way I have an error, during the execution it cannot find "mktemp". Here is the error:
"No such DSL method 'mktemp' found among steps"
Do you have a specific "global" library that imports the right tool? Maybe you already had this issue...
Thank you,
Hi brenuart, I'm also looking for the easiest way to pull dependencies in private repositories... For now how do you manage using credentials with Git inside a pipeline? Do you use withCredentials(...) function?
Thank you.