title: Add a tag to a repository with Jenkinsfile pipeline with credentials
body: <p>I'm new on <code>Jenkinsfile</code> and I'm trying to pass a job I have to a Jenkinsfile. I've successfully created all steps I needed but I can't add a tag to my git repository like I use to with the interface and the "git publisher" plugin.</p>
  
  <p>Here is what I've got now :</p>
  
  <pre><code>stage('Tag') {
   steps {
       script {
           env.POM_VERSION = readMavenPom().getVersion()
       }
       // creating the name of the tag
       sh '''#!/bin/bash -xe
         currentDate=$(date +"%Y-%m-%d_%Hh%Mm%Ss")
         customTagName="${CUSTOMER_NAME}--${POM_VERSION}--${currentDate}"
         echo CUSTOM_TAG_NAME=${customTagName} &gt;&gt; ${PROPERTIES_FILE_NAME}
       '''
       script {
           def PROPERTIES = readProperties file: "${PROPERTIES_FILE_NAME}"
           env.CUSTOM_TAG_NAME = PROPERTIES.CUSTOM_TAG_NAME
       }
       withCredentials([usernamePassword(credentialsId: "${GIT_CREDENTIALS_ID}", passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
           sh "git tag -a ${CUSTOM_TAG_NAME} -m 'Jenkinsfile push tag'"
           sh "git push https://${GIT_USERNAME}:${GIT_PASSWORD}@git.repohere.com/scm/reponamehere.git ${CUSTOM_TAG_NAME}"
       }
    }
  </code></pre>
  
  <p>}</p>
  
  <p>but then I've got this issue in logs:</p>
  
  <blockquote>
    <p>[Pipeline] sh
    + git push 'https://****:****@git.repohere.com/scm/reponamehere.git' name--4.36.0--2020-04-10_22h00m50s</p>
    
    <p>fatal: unable to access 'https://****:****@git.repohere.com/scm/reponamehere.git/': Could not resolve host: ****; Unknown error
    [Pipeline] }
    [Pipeline] // withCredentials</p>
  </blockquote>
  
  <p>I'm stuck on this for hours now, how can I add and push a tag with credentials added in jenkins config. Thank you!</p>