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:
withCredentials([sshUserPrivateKey(credentialsId: "my-cred-id", keyFileVariable: 'key')]) {
//auth to git here then do some commands for example:
sh 'git commmit -am "hello my commit message'
sh 'git push'
}
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.