Jenkins pipeline: checkout explicit git commit
Use a general scm step
checkout([$class: 'GitSCM', branches: [[name: commitHash ]],
userRemoteConfigs: [[url: 'http://git-server/user/repository.git']]])
Yuri G's example didn't work for me when jenkins lacked a workspace due to initial checkout. The following works in this case. I don't understand why they are all that different.
def commitId = "<insert sha here>"
checkout ( [$class: 'GitSCM',
branches: [[name: commitId ]],
userRemoteConfigs: [[
credentialsId: 'deploy key for your repo',
url: 'repo url']]])