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

Git plugin using wrong username for committer different from user running build set in user.name and user.email

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • git-plugin
    • None

      Using Git Plugin 2.3.4.

      When choosing GIT for source control system and specifying the git url with http and no username, when the plugin runs it sets the committer to a different user than the author and the one running the jenkins build.

      Setup:

      Jenkins build with Git.
      Executing Nant build script - this script has <exec> commands to call git for "git add ." and "git commit -m "Build Number" --author "svcClairviaBuild" and "git push origin Fixes"

      When the git plugin is enabled for the repo the final "push" commit to the remote repo always shows the wrong user but will show the author as the one specified.

      Jenkins is running as a service with the "svcClairviaBuild" user.

      Here is the commit message on the server: *MS030441 is not the committer why is this showing up?

      git config global -l = user.name=svcClairviaBuild user.email=svcClairviaBuild@johndoe.com

      BUILD:8.4.2.0-1179
      5a2a7bae5cBrowse code
      svcClairviaBuild authored 3 minutes ago *ms030441* committed 3 minutes ago

          [JENKINS-26830] Git plugin using wrong username for committer different from user running build set in user.name and user.email

          Mark Waite added a comment -

          I'm reasonably confident this is a configuration error, not a bug in the git plugin. Could you answer the following questions to further explore it:

          • What is the output if you run a batch build step on that node with the command "git config --list"?
          • What is the output if you run a batch build step on that node with the command "git config --get-all user.name"?
          • What is the output if you run a batch build step on that node with the command "git config --get-all user.email"?

          I assume the output of the first command will include user.name=ms030441 and the output of the second and third commands will include at least one line containing ms030441.

          If the output contains no entries for user.name or user.email, then the plugin is using defaults. You can set the defaults for the account on that slave with a build step 'git config user.name="Your Name"', then confirm with the "git config --list" build step that the setting was preserved.

          Mark Waite added a comment - I'm reasonably confident this is a configuration error, not a bug in the git plugin. Could you answer the following questions to further explore it: What is the output if you run a batch build step on that node with the command "git config --list"? What is the output if you run a batch build step on that node with the command "git config --get-all user.name"? What is the output if you run a batch build step on that node with the command "git config --get-all user.email"? I assume the output of the first command will include user.name=ms030441 and the output of the second and third commands will include at least one line containing ms030441. If the output contains no entries for user.name or user.email, then the plugin is using defaults. You can set the defaults for the account on that slave with a build step 'git config user.name="Your Name"', then confirm with the "git config --list" build step that the setting was preserved.

          Bret Askeland added a comment -

          I thought the exact same thing and checked all of those. But here is the output from the commands you want to see:

          $ git config --list
          core.symlinks=false
          core.autocrlf=false
          pack.packsizelimit=2g
          help.format=html
          http.sslcainfo=/bin/curl-ca-bundle.crt
          sendemail.smtpserver=/bin/msmtp.exe
          diff.astextplain.textconv=astextplain
          rebase.autosquash=true
          *user.name=svcClairviaBuild*
          *user.email=svcClairviaBuild@1234.com*

          $ git config --get-all user.name
          *svcClairviaBuild*

          $ git config --get-all user.email
          *svcClairviaBuild@1234.com*

          Also running this globally as I have it set for the user:
          $ git config --global --list
          *user.name=svcClairviaBuild*
          *user.email=svcClairviaBuild@1234.com*
          push.default=simple
          credential.helper=wincred

          Bret Askeland added a comment - I thought the exact same thing and checked all of those. But here is the output from the commands you want to see: $ git config --list core.symlinks=false core.autocrlf=false pack.packsizelimit=2g help.format=html http.sslcainfo=/bin/curl-ca-bundle.crt sendemail.smtpserver=/bin/msmtp.exe diff.astextplain.textconv=astextplain rebase.autosquash=true * user.name=svcClairviaBuild * * user.email=svcClairviaBuild@1234.com * $ git config --get-all user.name * svcClairviaBuild * $ git config --get-all user.email * svcClairviaBuild@1234.com * Also running this globally as I have it set for the user: $ git config --global --list * user.name=svcClairviaBuild * * user.email=svcClairviaBuild@1234.com * push.default=simple credential.helper=wincred

          Mark Waite added a comment -

          Does this stackoverflow article on committer vs. author apply in this case?

          Mark Waite added a comment - Does this stackoverflow article on committer vs. author apply in this case?

          Bret Askeland added a comment -

          Unfortunately it doesn't. I did some research that also suggested that, but that doesn't seem to be the issue.

          Bret Askeland added a comment - Unfortunately it doesn't. I did some research that also suggested that, but that doesn't seem to be the issue.

          Anand GT added a comment -

          Hi Bret,

          1. Can you try deleting all your work space (in my FS, it is: /var/lib/jenkins/workspace/) and do a fresh build after all your changes done
          2. If still not helping, then we have to delete the user from Github and re-add him, after git-credential changes in Jenkins, This will definitely help.

           

          Anand GT added a comment - Hi Bret, Can you try deleting all your work space (in my FS, it is: /var/lib/jenkins/workspace/) and do a fresh build after all your changes done If still not helping, then we have to delete the user from Github and re-add him, after git-credential changes in Jenkins, This will definitely help.  

            Unassigned Unassigned
            bretcj7 Bret Askeland
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: