title: Connecting Jenkins to AWS CodeCommit Repo
body: <p>I have deployed a local Jenkins server (Windows host) and am attempting to connect to a repo in Amazon's AWS CodeCommit service. 
  I have configured the AWS CodeDeploy credentials in Jenkins (via the AWS CodeDeploy Plugin) with my AWS Access Key and Secre Key. </p>
  
  <p>I have created a new freestyle project, and have selected Git under Source Code Management and configirued:
  Repository URL - copied the SSH url from AWS Code Commit console
  Credentials - I have created a global credential and pointed it to my private key, and entered the passphrase. </p>
  
  <p>When configuring the Repo URL the following error is displayed:</p>
  
  <blockquote>
    <p>Failed to connect to repository : Command "git.exe -c core.askpass=true ls-remote -h
    ssh://[REMOVED]@git-codecommit.us-east-1.amazonaws.com/v1/repos/[REMOVED]/
    HEAD" returned status code 128: stdout:  stderr: Permission denied
    (publickey).  fatal: Could not read from remote repository.</p>
    
    <p>Please make sure you have the correct access rights and the repository
    exists.</p>
  </blockquote>
  
  <p>Seems like a simple access error but for the life of me I cannot figure it out. If I open my git bash and paste the above command in, I am presented with:</p>
  
  <blockquote>
    <p>You have successfully authenticated over SSH. You can use Git to
    interact with AWS CodeCommit. Connection to
    git-codecommit.us-east-1.amazonaws.com closed by remote host. fatal:
    Could not read from remote repository.</p>
    
    <p>Please make sure you have the correct access rights and the repository
    exists.</p>
  </blockquote>
  
  <p>So It seems that the SSH connection is working. 
  When I run:</p>
  
  <pre><code>ssh -vT [REMOVED]@git-codecommit.us-east-1.amazonaws.com
  </code></pre>
  
  <p>I get the following output:</p>
  
  <blockquote>
    <p>You have successfully authenticated over SSH. You can use Git to
    interact with AWS CodeCommit. Interactive shells are not
    supported.debug1: channel 0: free: client-session, nchannels 1
    Connection to git-codecommit.us-east-1.amazonaws.com closed by remote
    host. Transferred: sent 4160, received 2368 bytes, in 0.2 seconds
    Bytes per second: sent 24893.3, received 14170.0 debug1: Exit status
    -1</p>
  </blockquote>
  
  <p>So it seems I really can access Code Commit okay. </p>
  
  <p>I have also verified that my IAM user is able to connect to CodeCommit by attached the CodeCommitFullAccess policy. I have also cloned the repo using git bash, on the Windows host running Jenkins.</p>
  
  <p>Does anyone know how I can get Jenkins to connect without displaying the error?</p>