title: Not able to read Git Environment variables Jenkins using Groovy Jenkinsfile
body: <p>The Git Plugin is installed (by default) in my Jenkins but I'm unable to get the env variables that are supposed to be passed in by the Git Plugin. I'm looking for:</p>
  
  <pre><code>GIT_COMMIT
  GIT_BRANCH
  GIT_PREVIOUS_COMMIT 
  GIT_PREVIOUS_SUCCESSFUL_COMMIT
  GIT_URL
  </code></pre>
  
  <p>etc.  I'm using the Pipeline Job Item that's pointing at a Github repo with the Jenkinsfile with the following code  </p>
  
  <pre><code>stage 'PushToProd'
  node {
      git url: "https://github.com/username/fakeurl.git"
      echo "Starting PushToProd"
      sh 'printenv'
      sh 'env'
      sh 'echo $BRANCH_NAME' 
      sh 'echo $GIT_COMMIT'
  }
  </code></pre>
  
  <p>I'm getting plenty of environment variables when I use <code>env</code> or <code>printenv</code> just not the Github plugin ones.<br>
  Any tips on how I can get the Git env variables passed in to the job?</p>
  
  <p><strong>Update</strong>: I'm able to easily get the Git env variables when I use a Freestyle Project and have a shell step use <code>echo $GIT_COMMIT</code>.  Still want to know though how to get it to work using Jenkinsfile + Pipeline job item. </p>