Search code examples
githudsongit-clone

Hudson - Git - Clone only required branch


Is it possible to clone only a single git branch in hudson ? Hudson version 2.2.0 with git plugin version 2.2.0 clones the entire specified project, thus occupying lot of space (which is expected to grow forever)

Thanks in advance.


Solution

  • Configuring refspec in the hudson-git plugin to the following value seems to be working:

    +refs/heads/master:refs/remotes/origin/master
    

    Addendum for 2023:

    In 2023 that is not enough, the "Honor refspec on initial clone" option under "Advanced clone behaviours" must also be enabled.

    Also "Shallow clone" can be enabled at the same place to save a bit more space (it omits downloading the history, it download only the latest version).