How can I get multiple Jenkins builds to work from one local git repo?

If you open the job configuration and click on the Advanced button of the git SCM configuration, you will see a place to specify "Path of the reference repo to use during clone (optional)".

If you have a local clone of your repository, add the path to the reference repo field.

Git will then use the local clone and share most of the git objects on the disk and pulling from github only what is missing from the local clone resulting in lightning fast clones and saved disk space.

Or is this exactly how you have configured your job and it is not picking up latest commits? If that is so, please provide more details. Consider publishing your job configuration.


Have a look at the Clone Workspace plugin. You can either use that or configure a job to update a local repository from Github and then have all the other jobs pull from that local repo.

This won't help with the problem that the workspaces still need the diskspace, but as far as I know there's no simple solution for that. You could either have the build steps change to a shared directory outside the workspace, but that's hacky and might break other things. Alternatively, you could use a filesystem that provides deduplication.

Tags:

Git

Jenkins