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

Git Username And Password does not resolve, Github app

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • git-plugin
    • None
    • 5.2.2

      I do not know if git-plugin is the problem but here we go. In a Scripted Pipeline i use withCredentials and gitUsernamePassword. 

      I use exactly the same credentials to clone repositories with in the checkout step as when using withCredentials in the pipeline.

      Regular repository clone

      stage('Clone Repositories') {
          steps {
              checkout([$class: 'GitSCM', 
                  branches: [[name: '*/master']], 
                  doGenerateSubmoduleConfigurations: false, 
                  submoduleCfg: [], 
                  userRemoteConfigs: [
                                          [
                                              credentialsId: '{GithubAppCredentials}', 
                                              url: 'https://github.com/org/repo.git', 
                                          ]
                                      ]
              ])
          }
      }
      

       

      Using withCredentials and gitUsernamePassword

      stage('withCredentials clone') {
           steps {
               withCredentials([
                   gitUsernamePassword(credentialsId: '{GithubAppCredentials}')
               ]) {
                   powershell '''
                   $env:GIT_TRACE=1
                   git clone https://github.com/HIABCS/SpaceX7Tests.git
                   '''
               } 
          }
       }
      

       

      8:18:58  06:18:57.325363 git.c:463               trace: built-in: git clone https://github.com/org/repo.git
      08:18:58  06:18:57.349442 run-command.c:659       trace: run_command: git remote-https origin https://github.com/org/repo.git
      08:18:58  Cloning into 'Tests'...
      08:18:58  06:18:57.391351 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
      08:18:58  06:18:57.392351 git.c:749               trace: exec: git-remote-https origin https://github.com/org/repo.git
      08:18:58  06:18:57.393354 run-command.c:659       trace: run_command: git-remote-https origin https://github.com/org/repo.git
      08:18:58  06:18:57.449356 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
      08:18:58  06:18:58.068357 run-command.c:659       trace: run_command: 'git credential-manager get'
      08:18:58  06:18:58.144354 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
      08:18:58  06:18:58.145356 git.c:749               trace: exec: git-credential-manager get
      08:18:58  06:18:58.145356 run-command.c:659       trace: run_command: git-credential-manager get
      08:18:58  06:18:58.281350 exec-cmd.c:244          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
      08:18:58  06:18:58.285351 git.c:463               trace: built-in: git config --null --list
      08:18:58  fatal: Unable to persist credentials with the 'wincredman' credential store.
      08:18:58  See https://aka.ms/gcm/credstores for more information.
      08:18:58  06:18:58.497204 run-command.c:659       trace: run_command: 
      08:18:58  **** 'Username for '\''https://github.com'\'': '
      08:18:58  The syntax of the command is incorrect.
      08:18:58  06:18:58.559212 run-command.c:659       trace: run_command: 
      08:18:58  **** 'Password for '\''https://github.com'\'': '
      08:18:58  The syntax of the command is incorrect.
      08:18:58  error: unable to read askpass response from ****
      08:18:58  06:18:58.604191 run-command.c:659       trace: run_command: bash -c 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
      08:18:58  bash: line 1: /dev/tty: No such device or address
      08:18:58  error: failed to execute prompt script (exit code 1)
      08:18:58  fatal: could not read Password for 'https://github.com': No such file or directory
      

      As i run SSH to a windows machine i cannot use credential store.
      And even when removing credential store it still failes just like this.

      I also tried to run it in bat instead of powershell but the same git error appears.

          [JENKINS-72044] Git Username And Password does not resolve, Github app

          Elias created issue -
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Elias made changes -
          Description Original: I do not know if git-plugin is the problem but here we go. In a Scripted Pipeline i use withCredentials and gitUsernamePassword. 

          I use exactly the same credentials to clone repositories with in the checkout step as when using withCredentials in the pipeline.

          *Regular repository clone*
          {code:java}
          stage('Clone Repositories') {
              steps {
                  checkout([$class: 'GitSCM',
                      branches: [[name: '*/master']],
                      doGenerateSubmoduleConfigurations: false,
                      submoduleCfg: [],
                      userRemoteConfigs: [
                                              [
                                                  credentialsId: '{GithubAppCredentials}',
                                                  url: 'https://github.com/org/repo.git&#39;,
                                              ]
                                          ]
                  ])
              }
          }
          {code}
           

          *Using withCredentials and gitUsernamePassword*
          {code:java}
          stage('withCredentials clone') {
               steps {
                   withCredentials([
                       gitUsernamePassword(credentialsId: '{GithubAppCredentials}')
                   ]) {
                       powershell '''
                       $env:GIT_TRACE=1
                       git clone https://github.com/HIABCS/SpaceX7Tests.git
                       '''
                   }
              }
           }
          {code}
           

          {code:java}
          8:18:58 06:18:57.325363 git.c:463 trace: built-in: git clone https://github.com/org/repo.git
          08:18:58 06:18:57.349442 run-command.c:659 trace: run_command: git remote-https origin https://github.com/HIABCS/SpaceX7Tests.git
          08:18:58 Cloning into 'SpaceX7Tests'...
          08:18:58 06:18:57.391351 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:57.392351 git.c:749 trace: exec: git-remote-https origin https://github.com/org/repo.git
          08:18:58 06:18:57.393354 run-command.c:659 trace: run_command: git-remote-https origin https://github.com/org/repo.git
          08:18:58 06:18:57.449356 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:58.068357 run-command.c:659 trace: run_command: 'git credential-manager get'
          08:18:58 06:18:58.144354 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:58.145356 git.c:749 trace: exec: git-credential-manager get
          08:18:58 06:18:58.145356 run-command.c:659 trace: run_command: git-credential-manager get
          08:18:58 06:18:58.281350 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:58.285351 git.c:463 trace: built-in: git config --null --list
          08:18:58 fatal: Unable to persist credentials with the 'wincredman' credential store.
          08:18:58 See https://aka.ms/gcm/credstores for more information.
          08:18:58 06:18:58.497204 run-command.c:659 trace: run_command:
          08:18:58 **** 'Username for '\''https://github.com&#39;\'': '
          08:18:58 The syntax of the command is incorrect.
          08:18:58 06:18:58.559212 run-command.c:659 trace: run_command:
          08:18:58 **** 'Password for '\''https://github.com&#39;\'': '
          08:18:58 The syntax of the command is incorrect.
          08:18:58 error: unable to read askpass response from ****
          08:18:58 06:18:58.604191 run-command.c:659 trace: run_command: bash -c 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
          08:18:58 bash: line 1: /dev/tty: No such device or address
          08:18:58 error: failed to execute prompt script (exit code 1)
          08:18:58 fatal: could not read Password for 'https://github.com&#39;: No such file or directory
          {code}

          As i run SSH to a windows machine i cannot use credential store.
          And even when removing credential store it still failes just like this.

          I also tried to run it in bat instead of powershell but the same git error appears.
          New: I do not know if git-plugin is the problem but here we go. In a Scripted Pipeline i use withCredentials and gitUsernamePassword. 

          I use exactly the same credentials to clone repositories with in the checkout step as when using withCredentials in the pipeline.

          *Regular repository clone*
          {code:java}
          stage('Clone Repositories') {
              steps {
                  checkout([$class: 'GitSCM',
                      branches: [[name: '*/master']],
                      doGenerateSubmoduleConfigurations: false,
                      submoduleCfg: [],
                      userRemoteConfigs: [
                                              [
                                                  credentialsId: '{GithubAppCredentials}',
                                                  url: 'https://github.com/org/repo.git&#39;,
                                              ]
                                          ]
                  ])
              }
          }
          {code}
           

          *Using withCredentials and gitUsernamePassword*
          {code:java}
          stage('withCredentials clone') {
               steps {
                   withCredentials([
                       gitUsernamePassword(credentialsId: '{GithubAppCredentials}')
                   ]) {
                       powershell '''
                       $env:GIT_TRACE=1
                       git clone https://github.com/HIABCS/SpaceX7Tests.git
                       '''
                   }
              }
           }
          {code}
           
          {code:java}
          8:18:58 06:18:57.325363 git.c:463 trace: built-in: git clone https://github.com/org/repo.git
          08:18:58 06:18:57.349442 run-command.c:659 trace: run_command: git remote-https origin https://github.com/org/repo.git
          08:18:58 Cloning into 'Tests'...
          08:18:58 06:18:57.391351 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:57.392351 git.c:749 trace: exec: git-remote-https origin https://github.com/org/repo.git
          08:18:58 06:18:57.393354 run-command.c:659 trace: run_command: git-remote-https origin https://github.com/org/repo.git
          08:18:58 06:18:57.449356 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:58.068357 run-command.c:659 trace: run_command: 'git credential-manager get'
          08:18:58 06:18:58.144354 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:58.145356 git.c:749 trace: exec: git-credential-manager get
          08:18:58 06:18:58.145356 run-command.c:659 trace: run_command: git-credential-manager get
          08:18:58 06:18:58.281350 exec-cmd.c:244 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
          08:18:58 06:18:58.285351 git.c:463 trace: built-in: git config --null --list
          08:18:58 fatal: Unable to persist credentials with the 'wincredman' credential store.
          08:18:58 See https://aka.ms/gcm/credstores for more information.
          08:18:58 06:18:58.497204 run-command.c:659 trace: run_command:
          08:18:58 **** 'Username for '\''https://github.com&#39;\'': '
          08:18:58 The syntax of the command is incorrect.
          08:18:58 06:18:58.559212 run-command.c:659 trace: run_command:
          08:18:58 **** 'Password for '\''https://github.com&#39;\'': '
          08:18:58 The syntax of the command is incorrect.
          08:18:58 error: unable to read askpass response from ****
          08:18:58 06:18:58.604191 run-command.c:659 trace: run_command: bash -c 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
          08:18:58 bash: line 1: /dev/tty: No such device or address
          08:18:58 error: failed to execute prompt script (exit code 1)
          08:18:58 fatal: could not read Password for 'https://github.com&#39;: No such file or directory
          {code}
          As i run SSH to a windows machine i cannot use credential store.
          And even when removing credential store it still failes just like this.

          I also tried to run it in bat instead of powershell but the same git error appears.
          Stefan made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Mark Waite made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Fixed but Unreleased [ 10203 ]
          Mark Waite made changes -
          Released As New: 5.2.2
          Status Original: Fixed but Unreleased [ 10203 ] New: Resolved [ 5 ]

            Unassigned Unassigned
            hiabvesteel Elias
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: