title: How to git clone with maven that uses an ssh-agent?
body: <p>I want to clone a repository with maven and the authentication must use an existing ssh-agent.</p>
  
  <p>My current plugin configuration:</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-scm-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.9.4&lt;/version&gt;
      &lt;configuration&gt;
          &lt;providerImplementations&gt;
                  &lt;git&gt;jgit&lt;/git&gt;
          &lt;/providerImplementations&gt;
      &lt;/configuration&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
                  &lt;groupId&gt;org.apache.maven.scm&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-scm-provider-jgit&lt;/artifactId&gt;
                  &lt;version&gt;1.9.4&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;clone-github-wiki&lt;/id&gt;
              &lt;goals&gt;
                  &lt;goal&gt;checkout&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;phase&gt;generate-resources&lt;/phase&gt;
              &lt;configuration&gt;
                  &lt;checkoutDirectory&gt;${project.basedir}/target/github-wiki&lt;/checkoutDirectory&gt;
                  &lt;connectionType&gt;connection&lt;/connectionType&gt;
                  &lt;connectionUrl&gt;scm:git:git@github.com:xyz/abc.wiki.git&lt;/connectionUrl&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Authentication is failing:</p>
  
  <pre><code>[INFO] --- maven-scm-plugin:1.9.4:checkout (clone-github-wiki) @ xyz-doc ---
  [INFO] Change the default 'git' provider implementation to 'jgit'.
  [INFO] Removing /home/jenkins/abc/doc/target/github-wiki
  [INFO] cloning [master] to /home/jenkins/abc/doc/target/github-wiki
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 1.490 s
  [INFO] Finished at: 2015-10-14T11:45:40+02:00
  [INFO] Final Memory: 15M/241M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.9.4:checkout (clone-github-wiki) on project xyz-doc: Cannot run checkout command : Exception while executing SCM command. JGit checkout failure! git@github.com:abc/xyz.wiki.git: Auth fail -&gt; [Help 1]
  [ERROR] 
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the following articles:
  </code></pre>