Checkout Jenkins Pipeline Git SCM with credentials?
<p>I was following <a href="https://jenkins.io/doc/pipeline/" rel="noreferrer">this tutorial</a>:</p>

<pre><code>node {
  git url: 'https://github.com/joe_user/simple-maven-project-with-tests.git'
  ...
}
</code></pre>

<p>However it doesn't tell how to add credentials. Jenkins does have specific "Credentials" section where you define user user&amp;pass, and then get ID for that to use in jobs, but how do I use that in Pipeline instructions?</p>

<p>I tried with:</p>

<pre><code>git([url: 'git@bitbucket.org:company/repo.git', branch: 'master', credentialsId: '12345-1234-4696-af25-123455'])
</code></pre>

<p>no luck:</p>

<pre><code>stderr: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
</code></pre>

<p>Is there a way configure the creds in pipeline, or do I have to put SSH-keys to Jenkin's Linux user's .ssh/authorized_keys file?</p>

<p>In ideal world I'd like to have a repository for pipeline jobs and repo-keys, then launch Docker Jenkins, and dynamically add these jobs and keys there without having to configure anything in Jenkins Console.</p>