Download a specific folder from on-prem GitLab

Viewed 92

I have an on-prem GitLab with a huge repository with many folders.

I'm trying to create a freestyle Jenkins job that would only retrieve the folder from the repository. (I have a read-permitted API token)

With Jenkins or a bash script, is it possible to retrieve only a specific folder from an on-prem GitLab installation?

I've tried many things from online suggestions but nothing worked.

Thanks ahead!

1 Answers

I solved such kind of issue as follow:

   git clone --no-checkout --depth=1 <REPO_URI> repo.local \
&& cd repo.local \
&& git checkout <REPO_BRANCH> <REPO_FOLDER>/*

In other words:

  1. You clone only the latest repo layer.
  2. You checkout only the folder you need.
Related