https://stackoverflow.com/questions/38461705/checkout-jenkins-pipeline-git-scm-with-credentials
withCredentials([usernamePassword(credentialsId: '<credentials-id>', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { sh ''' printf "machine github.com\nlogin $GIT_USERNAME\n password $GIT_PASSWORD" >> ~/.netrc // continue script as necessary working with git repo... ''' }