Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68414

Jenkins - Git Revision history shows password when I am using them in url. (https://{username}:{pwd}@bitbucket.com)

    XMLWordPrintable

Details

    Description

      Hi,

      I am using username and password on Bitbucket url to clone my repository in Jenkins groovy file and code is below.

      It is cloning successfully but it shows password in .git/config folder(inside workspace) and  git revision history (in Jenkins run console).

      I tried below commands to get rid off password display but it didn't work out.

                           sh 'git config user.email <email_address>'
                           sh 'git config user.name ${USER}'
                           sh 'git remote remove origin'
                           sh "git remote set-url ${gitUrl}"

       

      and the final results looks like below:

      code:

       checkout([$class: 'GitSCM',
                                                branches: [[name: 'develop']],
                                                doGenerateSubmoduleConfigurations: false,
                                                extensions: [[$class: 'LocalBranch', localBranch: "**"]],
                                                gitTool: 'GIT_Latest_Version',
                                                submoduleCfg: [],
                                                userRemoteConfigs: [[url:

      'https://\{username}:{password}@github.com/repo/repository.git']]])

      Attachments

        Activity

          People

            klimas7 Boguslaw Klimas
            samy_sk Karuppasamy Subburaj
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: