Git Plugin

This plugin allows use of GIT as a build SCM. Git 1.3.3 or newer is required.

Plugin Information

Plugin ID git
Latest Release 1.0.1
Latest Release Date Aug 09, 2010
Changes via Fisheye In Latest Release
Since Latest Release
Maintainer(s) n/a (id: abayer)
Issue Tracking Open Issues

Bugs

  • Check the open issues carefully to see if the issue has already been reported
  • Create an issue if needed, and make sure to choose the git sub-component.  Make sure to mention the plugin version number in the issue description.

Note: The latest master repository seems to be http://github.com/hudson/Hudson-GIT-plugin.

Gotchas

  • If you are seeing output indicating Git could not clone, something like the output below, go to to the Hudson configuration settings (not the project settings, the global ones) and change the Git path to a fully qualified path (eg. not "git" but "/usr/bin/git" or wherever your Git binary is installed). You should also verify that the permissions are correct if you are doing a file system based clone.
Started by user anonymous
Checkout:workspace / C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace - hudson.remoting.LocalChannel@1a1f370
Last Build : #4
Checkout:workspace / C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace - hudson.remoting.LocalChannel@1a1f370
Cloning the remote Git repository
Cloning repository origin
$ git clone -o origin git://github.com/bret/watir.git "C:\Documents and Settings\Administrator\.hudson\jobs\watir\workspace"
Trying next repository
ERROR: Could not clone from a repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:400)
    at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:358)
    at hudson.FilePath.act(FilePath.java:676)
    at hudson.FilePath.act(FilePath.java:660)
    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:358)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:833)
    at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:314)
    at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:266)
    at hudson.model.Run.run(Run.java:948)
    at hudson.model.Build.run(Build.java:112)
    at hudson.model.ResourceController.execute(ResourceController.java:93)
    at hudson.model.Executor.run(Executor.java:118)
  • You man need to tell git who the user hudson is running as is. To do this on a Linux/Unix system edit the user's entry in /etc/passwd to set their login shell to /bin/bash instead of /bin/false. Then switch to that user which is probably tomcat6. Do this by using either of the following.
    $ su tomcat6
    $ sudo su tomcat6
    

    Now cd to the directory where the clone hudson created is and use git config user.name and git config user.email to set the values.

    $ cd /srv/hudson/jobs/project/workspace
    $ git config user.email "some@email.com"
    $ git config user.name "hudson"
    

    When you are done, log off as the hudson user and change the login shell back to /bin/false

Changelog

Next release (in master)

  • Added ability for GitPublisher to only push if build succeeds. (issue #7176)
  • Fixed major bug with submodule behavior - making sure we don't try to fetch submodules until we've finished the initial clone. (issue #7258)
  • "Clean after checkout" wasn't invoked when pre-build merges were enabled. (issue #7276)
  • Form validation was missing for the GitPublisher tag and branch names, and an empty value was allowed for GitPublisher target repositories, leading to confusion. (issue #7277)

Version 1.0.1 (released August 9, 2010)

  • Fixed submodules support - was broken by issue #6902 fix. (issue #7141)
  • Switched "Recent Changes" list for a project to count changes per build, rather than using revision as if it were a number. (issue #7154)
  • Stopped putting problematic slash at end of GitWeb URL. (issue #7020)

Version 1.0 (released July 29, 2010)

  • Added support for Github as a repository browser.
  • Added support for optionally putting source in a subdirectory of the workspace (issue #6357)
  • If all repository fetches fail, fail the build. (issue #6902)
  • Improved logging of git command execution errors (issue #6330)
  • Basic support for excluded regions and excluded users in polling added (issue #4556)
  • Support for optionally checking out to a local branch, rather than detached HEAD (issue #6856)
  • Revamped GitPublisher to allow for pushing tags to remotes and pushing to remote branches, as well as existing push of merge results. (issue #5371)

Version 0.9.2 (released June 22, 2010)

  • Fixed major bug in BuildChooser default selection and serialization (issue #6827)

Version 0.9.1 (released June 22, 2010)

  • Dramatic improvement in changelog generation, thanks to a switch to use "git whatchanged" (issue #6781)

Version 0.9 (released June 17, 2010)

  • Improved support for BuildChooser as an extension point - other plugins can now implement their own BuildChoosers and have them automatically show up as an option in Git configuration when installed.
  • Options added for wiping out the workspace before the build begins (this option may be removed), and for using commit authors as the Hudson changelog entry author, rather than the committers, the default behavior.

Version 0.8.2

  • Support for Gerrit plugin.
  • Support for different build choosers.

Version 0.7.3

FIXME this changelog entry is incomplete! Please give me some love!

  • [FIXED HUDSON-2931] git tag freezing job execution (jbq)
  • Improve log messages (jbq)
  • Use build listener to report messages when pushing tags to origin (jbq)
  • [FIXED HUDSON-2762] Fail to clone a repository on Windows (jbq)

Version 0.5

  • Fix git plugin which was very broken when running on a remote server (magnayn)
  • Fix NPE in GitChangeLogParser upon project's first build (jbq)
  • Change workspace to a FilePath in GitAPI (jbq)
  • Use git rev-list once instead of invoking git rev-parse indefinitely to find last build, see Issue 2469: GIT plugin very slow (jbq)
  • Handle null-value of the repositories field to ensure backwards-compatibility with version 0.3,
    ie when the project configuration is missing the <repositories/> XML element (jbq)
  • Improve error handling in revParse() (jbq)
  • Fix handling of the "branch" configuration parameter (jbq)
  • Improve tag handling, use show-ref instead of rev-parse to resolve the tag reference (jbq)
  • Fix Issue 2675: Git fails on remote slaves (jbq)

Version 0.4 (never released)

  • Allow multiple GIT repositories to be specified (magnayn)
  • Allow submodule configurations to be generated on the fly (magnayn)
  • Avoid infinite loops when git doesn't contains tags (david_calavera)
  • Don't do a log of the entire branch if it's never been built (magnayn)

 Version 0.3

  • Add support for pre-build branch merges

 Version 0.2

  • Improve handling of git repositories (use local tags to identify up to date versions rather than the wc HEAD)
  • Don't have to specify a branch, in which case all branches are examined for changes and built
  • Includes a publisher which can be used to push build success/failure tags back up to the upstream repository

 Version 0.1

  • Initial Release

Advanced Features

Using Git, Hudson and pre-build branch merging

Continuous Integration tools such as Hudson are useful on projects as they give users early indication that a particular codebase is 'unstable' - and that if a developer checks it out, there will be trouble ahead (they won't be able to work on their own code, because someone else has broken something).

Unfortunately, by the time the build completes, this is often too late (particularly if the build cycle time is very long), as a developer has updated their working copy to the latest, unstable code in the repository and has begun work.

This can lead to the code base remaining unstable as developers tread on each others toes steadily fixing one thing, but breaking something else.

Some environments (e.g. TeamCity) attempt to fix this by making commits into SVN only 'really' happen once they have been tested. These kinds of 'delayed-commits' are problematic, because local SCM tools assume that commits will be immediately available, which can confuse them. In many ways this mechanism is a hack to get around the fact that branch management in SVN is very heavyweight.

Fortunately, with GIT and Hudson, you can achieve the same 'stable branches' with minimal effort.

Set up your hudson project, and leave the 'branch' field in the Git SCM blank. This will cause Hudson to consider any change on any branch for building.

Next, pick a particular branch name as the integration target in the 'Advanced' section - (e.g. 'master', or 'stable'), and select 'Merge before build'.

Select 'Push GIT tags back to origin repository' from the post-build actions (this is required to update your centralised git repo with the results of the build).

Now, developers should never commit directly to your integration branch (the 'master' or 'stable'). Instead, they should either use feature branches, or create new remote branches on commit (e.g : "git push origin HEAD:refs/heads/myNewFeature"). You could also set up your GIT repository to only accept commits onto the integration branch from Hudson.

You're done. Commits should now be automatically merged with the integration branch (they will fail if they do not merge cleanly), and built. If the build succeeds, the result of the merge will be pushed back to the remote git repository.

Using Extra Repositories

Since GIT is a Distributed SCM, it is possible in the Advanced section to specify multiple repositories. You may wish to do this to, for example, pull all in-progress work from individual developers machines, and pre-test them before they are committed to a centralised repository - this way developers may get an early warning that a branch in progress may not be stable.

The GIT plugin will make reasonable attempts to try and pull submodule states from distributed repositories, with the proviso that this feature is not currently well supported within GIT itself.

Autogenerate submodule configurations

A common development pattern for many users is the use of a 'superproject' that aggregates a number of submodules. For example, ProjectA may have ComponentA, ComponentB and ComponentC. ComponentA is a shared library, and is set to use a particular revision (maybe on a branch called 'ProjectA' in case there are any changes). Usually, any changes to the project configuration require a commit to the ProjectA superproject.

However - there could be other changes happening on other branches of ComponentA (say to the development of the next version). Without someone generating commits into ProjectA to test these, any regressions or incompatibilities may be missed.

The autogenerate submodule configurations feature will create commits into ProjectA for all possible combinations of the branches present in the submodules that the project uses.

Labels:

plugin-scm plugin-scm Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jun 23, 2009

    Kohsuke Kawaguchi says:

    Through rtyler: http://github.com/stephenh/git-central/blob/master/server/post-r...

    Through rtyler: http://github.com/stephenh/git-central/blob/master/server/post-receive-hudson automates the set up of a Hudson job whenever a new branch is created. Nice.

  2. Jul 22, 2009

    J. Longman says:

    How do I build a specific revision? I used to be able to specify a build should ...

    How do I build a specific revision? I used to be able to specify a build should use SHA1-ID, like build origin/bdbbfc3f0e9c57fbeff89de2ad7ca308a168575e and it would work.  This is necessary for reproducibility.

    Has this changed? How do I do this now?

  3. Nov 17, 2009

    Kenneth P. Turvey says:

    I wrote a tutorial on getting hudson to work with git and grails.  It inclu...

    I wrote a tutorial on getting hudson to work with git and grails.  It includes all the information necessary to set up an integration server using git and hudson even if you aren't interested in grails development:

    http://www.electricsenator.net/2009/10/03/1254618530821.html

  4. Nov 18, 2009

    Graeme Simpson says:

    Is it possible to use credentials when accessing a git repository? Or certificat...

    Is it possible to use credentials when accessing a git repository? Or certificates?

    Thanks,
    Graeme

  5. Jan 01, 2010

    Chas Emerick says:

    Is there any way to get the git plugin to checkout ref names instead of the sha'...

    Is there any way to get the git plugin to checkout ref names instead of the sha's associated with remote refs? Not being on a branch in the course of a build is causing issues (for at least two of us) in conjunction with the M2 Release Plugin:

    Can’t get automated release working with Hudson + Git + Maven Release Plugin

    1. Feb 02, 2010

      Chas Emerick says:

      This issue has been resolved for me as of v0.8.0 of the git plugin.  See my...

      This issue has been resolved for me as of v0.8.0 of the git plugin.  See my comment below.

      1. Mar 17

        David Antliff says:

        Really? I'm using 0.8 (by using the Hudson plugin upgrader) and still seeing Hud...

        Really? I'm using 0.8 (by using the Hudson plugin upgrader) and still seeing Hudson check out a specific SHA-1 rather than a reference:

        [workspace] $ git checkout -f 2904dc785ef11727aab604b2119bfbb4341a24bc
        

        even though I specified "origin/myBranch" in the Branch Specifier field. This detaches HEAD and makes it impossible (or very hard at least) for a subsequent build script to know what branch it's building on.

  6. Jan 06, 2010

    Brad Robertson says:

    I can't get Hudson to merge into the master branch. It always ends up in *no br...

    I can't get Hudson to merge into the master branch. It always ends up in *no branch, which is no good to me as I want to push master to another remote repo as a deploy.
    I've set the following:
    refspec: +refs/heads/master:refs/remotes/origin/master
    branch to build: */master
    branch to merge to: master

    The Git logs show it fetching the latest, then for some reason checking out the previous version with the sha, which puts it into *no branch. Then it does a git merge with the latest, still on *no branch. I've included the logs below.

    I don't think this is the correct behavior given that I specify that I want to merge to the master branch. Thoughts? Bug?

    Git logs from hudson:
    git fetch /home/git/repositories/my_repo.git +refs/heads/master:refs/remotes/origin/master
    git ls-tree HEAD
    git rev-parse master
    git checkout -f old_rev_sha here's where it switches branches
    git merge new_rev_sha

    1. Jan 08, 2010

      Chas Emerick says:

      I don't know if this is a bug, but +1 that this isn't correct behaviour IMO (see...

      I don't know if this is a bug, but +1 that this isn't correct behaviour IMO (see my comment directly above yours).

      1. Jan 09, 2010

        Brad Robertson says:

        ya i read that. I'm also confused as to why it's using sha's, especially when t...

        ya i read that. I'm also confused as to why it's using sha's, especially when the plugin allows you to specify the ref you want and the branch to merge to.

        I personally do think it's a bug if you are specifying the branch to merge to and the fetched code is not merged to that branch

        1. Feb 02, 2010

          Chas Emerick says:

          I upgraded to v0.8.0 of the git plugin, and have been able to perform a maven re...

          I upgraded to v0.8.0 of the git plugin, and have been able to perform a maven release using the Maven release plugin, and have the results successfully pushed back to master.

          v0.8.0 appears to add a "Merge options" section (in the advanced tab under the SCM section of the project config).  I put "origin" in 'name of repository' and "master" in 'branch to merge to', and the push went swimmingly.

          1. Feb 11, 2010

            Brad Robertson says:

            Merge options were definitely available in 0.73. I mentioned above that I put i...

            Merge options were definitely available in 0.73. I mentioned above that I put in "master" as "branch to merge to" in my settings and it still didn't work. I haven't upgraded to 0.8 though so I'll check it out when I get a chance. I don't know how this can't be documented anywhere though.

            1. Mar 16

              David Antliff says:

              Brad: did you have any success with 0.8 in this respect? I'm seeing Hudson conti...

              Brad: did you have any success with 0.8 in this respect? I'm seeing Hudson continue to check out the specific SHA rather than the branch reference, and therefore detach the HEAD.

              1. Mar 17

                Brad Robertson says:

                To be honest, I haven't looked at this in quite some time, i'm working on a few ...

                To be honest, I haven't looked at this in quite some time, i'm working on a few projects so i've been fairly busy. I'll keep you posted when I find the time to see if this has been fixed for me.

  7. Jan 11, 2010

    Anonymous ultimo says:

    Problems with new 0.8 version under windows. It looks very good and the new inf...

    Problems with new 0.8 version under windows.

    It looks very good and the new information about changed files is great but scm polling doesn't work anymore

    1. Feb 08, 2010

      J. Longman says:

      I'm also having problems, but I'm not using windows: Feb 8, 2010 11:51:03 AM h...

      I'm also having problems, but I'm not using windows:

      Feb 8, 2010 11:51:03 AM hudson.triggers.SCMTrigger$Runner runPolling
      SEVERE: Failed to record SCM polling
      java.lang.NullPointerException
      	at hudson.plugins.git.GitSCM.pollChanges(GitSCM.java:254)
      	at hudson.model.AbstractProject.pollSCMChanges(AbstractProject.java:1067)
      	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:319)
      	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:346)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
      	at java.lang.Thread.run(Thread.java:619)
      
      Solved by adding executors to my master
  8. Mar 16

    David Antliff says:

    Is there an inconsistency here? This page says 0.8 is the Latest Release, but th...

    Is there an inconsistency here? This page says 0.8 is the Latest Release, but the download link to the .hpi file is pointing at 0.7.3.

    What is the download link to the 0.8 hpi please, as I need to archive this file for static installation at my site.

  9. Mar 27

    Evgeny Goldin says:

    Hi, I have a problem with latest Hudson v1.352 and Git plugin v0.8.1. After fet...

    Hi,

    I have a problem with latest Hudson v1.352 and Git plugin v0.8.1.
    After fetching successfully Git sources - Maven fails with NPE

    java.lang.NullPointerException
    	at java.util.Hashtable.put(Hashtable.java:394)
    	at java.util.Hashtable.putAll(Hashtable.java:466)
    	at hudson.maven.MavenBuilder.call(MavenBuilder.java:156)
    	at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:688)
    	at hudson.maven.MavenModuleSetBuild$Builder.call(MavenModuleSetBuild.java:632)
    	at hudson.remoting.UserRequest.perform(UserRequest.java:114)
    	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    	at hudson.remoting.Request$2.run(Request.java:270)
    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    	at java.lang.Thread.run(Thread.java:619)
    

    Here's the full log and job's configuration

    Git plugin passes null value for GIT_BRANCH environment variable,
    which later fails in MavenBuilder.java:156 when Maven plugin calls
    System.getProperties().putAll(systemProps)

    Here's a debugger screenshot.

    1. Mar 27

      Evgeny Goldin says:

      Fixed it by specifying "master" as default branch, not empty and not "**...

      Fixed it by specifying "master" as default branch, not empty and not "**".
      Posted it in my blog as well.

  10. Apr 02

    Mark Moore says:

    I'm hoping this is the right place to post this question...  It looks like ...

    I'm hoping this is the right place to post this question...  It looks like the Git plugin simply issues a git fetch origin master (or something reasonably similar).  I want to force a clean before fetching.  specifically "git -fx clean"  Does anyone know how to make this happen?  I could add this to the build commands, but that seems a little wrong.

    Help!

    -Mark

    1. Apr 02

      David Antliff says:

      What we do is issue the 'git clean' command as one of the first things the build...

      What we do is issue the 'git clean' command as one of the first things the build script (stored within the repository) executes. You could add it to the build command list if you wanted to, I don't think it's wrong. Hudson is just responsible for cloning/updating.

      I just wish it checked out a ref instead of a commit, or at least set an environment variable to the specified branch name :)

  11. May 06

    Mik Lernout says:

    This page should probably mention that the Git plugin relies on a recent version...

    This page should probably mention that the Git plugin relies on a recent version of the Git binaries (at least 1.7?).

  12. Jun 15

    Ian Eure says:

    Same problem here with builds always starting from a detached HEAD. I'm using th...

    Same problem here with builds always starting from a detached HEAD. I'm using the most recent version of the plugin, 0.8.3.

    My config is:

    URL of repository: git://github.com/simplegeo/libmemcached.git
    Name of repository: origin
    Refspec: +refs/heads/*:refs/remotes/origin/*
    
    Branches to build: master
    
    Merge before build: Yes
    Name of repository: origin
    Branch to merge to: master
    
    Clean after checkout: Yes
    Choosing strategy: Default
    Repository browser: (Auto)
    

    These are the git commands that get run:

    Checkout:libmemcached-test / /home/pubhudsonslave/workspace/libmemcached-test - hudson.remoting.Channel@581ea2:pubhudsonslave
    Using strategy: Default
    Last Built Revision: Revision 13e70eabe93822d0ce7fceee6ebcbbd490b19a76 (origin/master)
    Checkout:libmemcached-test / /home/pubhudsonslave/workspace/libmemcached-test - hudson.remoting.LocalChannel@135c7da7
    GitAPI created
    Fetching changes from the remote Git repository
    Fetching upstream changes from git://github.com/simplegeo/libmemcached.git
    [libmemcached-test] $ git fetch -t git://github.com/simplegeo/libmemcached.git +refs/heads/*:refs/remotes/origin/*
    [libmemcached-test] $ git ls-tree HEAD
    [libmemcached-test] $ git tag -l master
    [libmemcached-test] $ git rev-parse origin/master
    Commencing build of Revision 13e70eabe93822d0ce7fceee6ebcbbd490b19a76 (origin/master)
    GitAPI created
    Checking out Revision 13e70eabe93822d0ce7fceee6ebcbbd490b19a76 (origin/master)
    [libmemcached-test] $ git checkout -f 13e70eabe93822d0ce7fceee6ebcbbd490b19a76
    [libmemcached-test] $ git tag -a -f -m "Hudson Build #7" hudson-libmemcached-test-7
    Recording changes in branch origin/master
    [libmemcached-test] $ git log --pretty=format:%H 13e70eabe93822d0ce7fceee6ebcbbd490b19a76..13e70eabe93822d0ce7fceee6ebcbbd490b19a76
    Cleaning workspace
    [libmemcached-test] $ git clean -fdx
    Finished: SUCCESS
    

    It's not merging anything, and it's still checking out a SHA-1 instead of a symbolic branch name. What gives?

  13. Jun 18

    Alexander Sparkowsky says:

    I'm trying to figure out how the tags generated by the plugin for each build are...

    I'm trying to figure out how the tags generated by the plugin for each build are pushed back to the origin repository.

    The text above mentions an option called 'Push GIT tags back to origin repository' but I'm not able to find it.

    So how do I get the plugin pushing the tags for each build to the upstream repo?

  14. Jun 25

    ITDude says:

    Folks, I'm experiencing problems setting up the GIT Plugin on a Debian system us...

    Folks, I'm experiencing problems setting up the GIT Plugin on a Debian system using a SSH key for authentication and was hoping somebody has had some experience with this setup who could offer some pointers.

    I believe the problem is that it fails to find the key and thus present it to the GIT server. I've installed a valid key into the /usr/share/tomcat5.5/.ssh directory which is the home of the tomcat55 user but it fails with a ssh-askpass error.

    Now I'm guessing that the process is running as the tomcat55 user but I could be wrong as looking at the logs below you can see that it is attempting to fetch to the /home/hudson directory. What's confusing about this is that the system does not have a user 'hudson' and in the System Information section of the web interface the enveronment looks as though it's running as the root user.

    Here's the log output;

    ------------------
    Started by user ITDude
    Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@f74f6ef
    Using strategy: Default
    Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@f74f6ef
    GitAPI created
    Fetching changes from the remote Git repository
    Fetching upstream changes from git@git.mycomp.com:test_hudson.git
    [workspace] $ /usr/bin/git fetch -t git@git.mycomp.com:test_hudson.git +refs/heads/:refs/remotes/origin/
    No protocol specified

    (ssh-askpass:13369): Gtk-WARNING **: cannot open display: :0.0
    Permission denied, please try again.
    No protocol specified

    (ssh-askpass:13370): Gtk-WARNING **: cannot open display: :0.0
    Permission denied, please try again.
    No protocol specified

    (ssh-askpass:13371): Gtk-WARNING **: cannot open display: :0.0
    Permission denied (publickey,password).
    fatal: The remote end hung up unexpectedly
    ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
    ERROR: Nothing to do
    Finished: FAILURE
    ========================

    The key is definitely valid as I've tested it with a manual connection.

  15. Jun 25

    Dale Hards says:

    Hello, I'm having difficulties getting the git plugin to fetch from the reposit...

    Hello,

    I'm having difficulties getting the git plugin to fetch from the repository. In the job's configuration I have provided:

    URL of repository: git@git.mydomain.com:test_hudson.git

    • which as far as I know is correct.

    Name of repository: origin/master

    • I have two choices. My repository is remote and according to Git Extensions on my Windows machine where I am pushing code to the central repository the repository is either origin/HEAD or origin/master - I have tried both.

    Refspec: I leave this blank and it generates the following: +refs/heads/:refs/remotes/origin/master/

    I have also provided the Branches to build: master

    I have tried many different combinations of settings, and each one gives a different error message, but none of them are ever getting to the point where Ant builds my simple Java project. On the above settings, I get the following log:

    ***

    Started by user daleh
    Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@3219ab8d
    Using strategy: Default
    Checkout:workspace / /home/hudson/jobs/TestHudson/workspace - hudson.remoting.LocalChannel@3219ab8d
    GitAPI created
    Fetching changes from the remote Git repository
    Fetching upstream changes from git@git.mydomain.com:test_hudson.git
    [workspace] $ /usr/bin/git fetch -t git@git.mydomain.com:test_hudson.git +refs/heads/:refs/remotes/origin/master/
    error: unable to resolve reference refs/remotes/origin/master/master: Not a directory
    From git@git.mydomain.com:test_hudson
    ! [new branch] master -> origin/master/master (unable to update local ref)
    error: some local refs could not be updated; try running
    'git remote prune git@git.mydomain.com:test_hudson.git' to remove any old, conflicting branches
    ERROR: Problem fetching from origin/master / origin/master - could be unavailable. Continuing anyway
    [workspace] $ /usr/bin/git tag -l master
    [workspace] $ /usr/bin/git rev-parse origin/master/master
    ERROR: Nothing to do
    Finished: FAILURE

    ***

    As for needing to remove any "old conflicting branches", I have none. This is a simple project with no conflicting branches.

    Thanks in advance for any help provided

    1. Jun 27

      Dale Hards says:

      This has now been resolved through the mailing list. The problem was that origin...

      This has now been resolved through the mailing list. The problem was that origin/master is a branch not a repository. I needed to leave the repository blank (letting it be automatically set as "origin"), and supplying "origin/master" in the "build branch" setting. This fixed the problem fine.

  16. Jul 13

    Adam Szecowka says:

    Hello, I have repoA and repoB, and i want clone repoA to directory for example w...

    Hello,
    I have repoA and repoB, and i want clone repoA to directory for example workspace/myJob/A and clone repoB to workspace/myJob/B. Is it possible with this plugin ?

  17. Jul 26

    Dave Abrahams says:

    Having Serious Submodule Problems. I confess that I don't understand what the d...

    Having Serious Submodule Problems. I confess that I don't understand what the documentation above about automatic submodule handling is trying to convey about what Hudson is doing, but whatever it is, it seems to be wrong. I'm content to do the git submodule init / git submodule update myself if necessary. Log below; can you please help? Thanks!

    Started by user dave
    Checkout:workspace / /var/lib/hudson/jobs/Boost/workspace - hudson.remoting.LocalChannel@3faa7a6a
    Using strategy: Default
    Last Built Revision: Revision 9fc9270750b81ec49fb96ee7b37fde5547da67c7 (origin/master)
    Checkout:workspace / /var/lib/hudson/jobs/Boost/workspace - hudson.remoting.LocalChannel@3faa7a6a
    GitAPI created
    Cloning the remote Git repository
    Cloning repository origin
    $ git clone -o origin git://gitorious.org/ryppl/boost.git /var/lib/hudson/jobs/Boost/workspace
    Fetching upstream changes from git://gitorious.org/ryppl/boost.git
    [workspace] $ git fetch -t git://gitorious.org/ryppl/boost.git +refs/heads/:refs/remotes/origin/
    [workspace] $ git ls-tree HEAD
    GitAPI created
    Fetching upstream changes from git://gitorious.org/ryppl/boost.git/cmake/.git
    [cmake] $ git fetch -t git://gitorious.org/ryppl/boost.git/cmake/.git +refs/heads/:refs/remotes/origin/
    fatal: protocol error: expected sha/ref, got '
    ----------------------------------------------
    Cannot find repository /ryppl/boost.git/cmake/.git
    ----------------------------------------------'
    ERROR: Problem fetching from origin - could be unavailable. Continuing anyway
    [workspace] $ git submodule init
    [workspace] $ git submodule update
    [workspace] $ git tag -l master
    [workspace] $ git rev-parse origin/master
    Commencing build of Revision 9fc9270750b81ec49fb96ee7b37fde5547da67c7 (origin/master)
    GitAPI created
    Checking out Revision 9fc9270750b81ec49fb96ee7b37fde5547da67c7 (origin/master)
    [workspace] $ git checkout -f 9fc9270750b81ec49fb96ee7b37fde5547da67c7
    [workspace] $ git submodule init
    [workspace] $ git submodule sync
    Fetching upstream changes from git://gitorious.org/ryppl/boost.git
    [workspace] $ git fetch -t git://gitorious.org/ryppl/boost.git +refs/heads/:refs/remotes/origin/
    [workspace] $ git ls-tree HEAD
    GitAPI created
    Fetching upstream changes from git://gitorious.org/ryppl/boost.git/cmake/.git
    [cmake] $ git fetch -t git://gitorious.org/ryppl/boost.git/cmake/.git +refs/heads/:refs/remotes/origin/
    fatal: protocol error: expected sha/ref, got '
    ----------------------------------------------
    Cannot find repository /ryppl/boost.git/cmake/.git
    ----------------------------------------------'
    ERROR: Problem fetching from origin - could be unavailable. Continuing anyway
    [workspace] $ git submodule update
    [workspace] $ git tag -a -f -m "Hudson Build #4" hudson-Boost-4
    Recording changes in branch origin/master
    [workspace] $ git whatchanged --no-abbrev -M --pretty=raw 9fc9270750b81ec49fb96ee7b37fde5547da67c7..9fc9270750b81ec49fb96ee7b37fde5547da67c7
    Triggering default
    Finished: FAILURE

    1. Aug 06

      Vincent Driessen says:

      The error occurs directly after the "git ls-tree HEAD" command. Assuming a defau...

      The error occurs directly after the "git ls-tree HEAD" command. Assuming a default Git repo setup, HEAD refers to "master" at that stage. I think the output of that process is scanned and each entry that has mode flag 160000 (= submodule commit) is filtered out and processed accordingly.

      How it detects and fetches from the submodule URL? I have no clue at all, but I know it's wrong.

      Furthermore, I have a branch called "develop" that does NOT have a submodule commit, but my master does. Even it I configure a Hudson job to fetch from branch "develop", it still uses "git ls-tree HEAD" to scan/parse for submodules, before switching to "develop", also breaking those builds. I've filed this as a bug on the Git plugin issue list (see http://github.com/magnayn/Hudson-GIT-plugin/issues#issue/4).

  18. Aug 25

    Miraj Hasnaine Tafsir says:

    There is no included region feature for GIT. If there are some few regions to be...

    There is no included region feature for GIT. If there are some few regions to be participated in the build I think its not a good idea to have so many excluded regions to be listed. Included region will be doing better in this case.

    1. about an hour ago

      Patrick Renaud says:

      I second that. Did you submit a JIRA for this yet?

      I second that. Did you submit a JIRA for this yet?