Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins: Clone workspace plugin does not clone .git directory

Tags:

git

jenkins

I am using the Clone Workspace SCM plugin in a build pipeline (see this related question). It is configured to include **/*.

The plugin does not copy the .git directory or the .gitignore and .gitattributes files. I need the .git directory for one of the jobs in the pipeline and I cannot use the git SCM directly, because then the job would get triggered by push events and I don't want that. (see linked question)

So how do I tell the Clone Workspace SCM to include the .git directory?

I tried with **/*,.git/ but that didn't work.

like image 532
Amedee Van Gasse Avatar asked Oct 15 '25 03:10

Amedee Van Gasse


1 Answers

To answer my own question:

The Clone Workspace SCM apparently uses something called the "Ant default excludes". I found the answer in this SO answer that points to the Apache Ant docs.

**/.git
**/.git/**
**/.gitattributes
**/.gitignore

are part of the default excludes.

Fortunately the Clone Workspace SCM plugin has a checkbox Override Default Ant Excludes. Enable that, problem solved!

like image 145
Amedee Van Gasse Avatar answered Oct 18 '25 13:10

Amedee Van Gasse



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!