title: Jenkins, using withCredentials, how can i authenticate to Git using the SSH private key?
body: <p>The github key is stored in Jenkins. Now I have a  Jenkins job that uses the withCredentials plugin to get that private key like this:</p>
  <pre><code>withCredentials([sshUserPrivateKey(credentialsId: &quot;my-cred-id&quot;, keyFileVariable: 'key')]) {
      //auth to git here then do some commands for example:
      sh 'git commmit -am &quot;hello my commit message'
      sh 'git push'
  }
  </code></pre>
  <p>Now what i want to do is within the withCredentials block to run a few git commands like the example shows above. However, i'm not sure how to use the keyFileVariable in order to authenticate to git so i can run these commands.</p>