I know how to download a file from a gitlab repo and I didn't find anything on downloading a directory. I need to download only a directory.
Asked
Active
Viewed 3,770 times
4 Answers
1
I have not used curl or wget but you can use sparse checkout to get the similar thing done.
This should solve your problem. :)

Sunny Sharma
- 11
- 3
-
I had to do it using curl/wget – Ashwani Nov 20 '19 at 17:48
0
You could try and combine:
- a
git archive --remote
approach which will get the latest files (no history): seegit archive --remote
- with extracting the folder from the tarball
That is (extracting a tar archive from stdin):
git archive --remote git@gitlab.com:<user>/<repo> main | tar -xvf - specificDir

VonC
- 1,262,500
- 529
- 4,410
- 5,250
0
As @VonC edit queue is full, here is the correct command line for git archive:
git archive --remote git@gitlab.com:<user>/<repo> main | tar -xvf - specificDir
- main: is branch name
- specificDir: specific dir to untar, it's optional

Limmy
- 53
- 12
-1
I didn't find any solution to download a specific folder, to download the complete repository I used following approach:
curl --request GET --header PRIVATE-TOKEN:${GITLAB_TOKEN} https://gitlab.com/api/v4/projects/project_id/repository/archive/ | tar -xz -C /tmp/project-name/

Ashwani
- 1,340
- 1
- 16
- 34