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

Git Publisher doesn't PUSH if JGit is used

XMLWordPrintable

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

      I am running a simple configuration, but can't get the "Git Publisher" post build step, to push anything to the origin repository. Configuration details:

      SCM:

      • Repository: ssh://server:port/repository.git
      • Credentials: SSH
      • Name: origin
      • Branches to build: */master
      • Additional Behaviours:
        • Wipe out repository & force clone
        • Check out to specific local branch
          • Branch name: master

      Git can't be installed natively to the server, so I am using jgit.sh and run a execute shell command after editing the workspace:

      $JENKINS_HOME/tools/jgit.sh commit -a -m "Build by Jenkins"
      

      Post-build Actions

      • Git publisher
        • Merge Results: Yes
        • Branches
          • Branch to push: master
          • Target remote name: origin

      The build executes sucessfully. Here is the log:

      Started by user USER
      [EnvInject] - Loading node environment variables.
      Building in workspace /path/Project Name
      Wiping out workspace first.
      Cloning the remote Git repository
      remote: Counting objects
      remote: Finding sources
      Receiving objects
      Resolving deltas
      Updating references
      Checking out Revision f28401201c1f83952a513154bc8bcab8b4dc7853 (refs/remotes/origin/master)
      [Project Name] $ /bin/sh -xe /temp/hudson5909337188362221229.sh
      + /bin/rm -rf ./maven
      + /bin/rm -rf ./resources
      + /bin/rm -rf ./MANIFEST.MF
      Copied 92 artifacts from "Other Build Source" build number 65
      [Project Name] $ /bin/sh -xe /temp/hudson9204382993817407491.sh
      + /tools/jgit.sh commit -a -m 'Build by Jenkins'
      [master 38217f6cbb454bb6c6001d548cab378704879651] Build by Jenkins
      Pushing HEAD to branch master at repo origin
      Opening connection
      Counting objects
      Finding sources
      Getting sizes
      Compressing objects
      Writing objects
      remote: Resolving deltas
      Finished: SUCCESS
      

      Anyways, nothing is pushed to the repo... I don't have any clue, I have tried to many things. If I download the workspace afterwards, and check git show-ref there are two:

      38217f6cbb454bb6c6001d548cab378704879651 refs/heads/master
      f28401201c1f83952a513154bc8bcab8b4dc7853 refs/remotes/origin/master

      Why wasn't the refs/heads/master pushed? Could you please assist?

      Thanks & regards,
      Kristian

            ndeloof Nicolas De Loof
            kriskra Kristian Kraljic
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: