Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

download directory from a branch using Gitlab API v4

I am trying to download a directory inside of a 'release' branch of a repository from Gitlab. I am using API v4.

The branch includes is of the below structure:

- archive
  - outputs
    - history-2020-01-01T142535 
    - history-2020-01-15T142559
    - history-2020-02-01T142540

I want to get the "history-2020-02-01T142540" directory.

I can get a ZIP archive of the entire branch...

https://<GITLAB_URL>/api/v4/projects/<PROJECT_ID>/repository/archive.zip?sha=<BRANCH_ID>

How do I get a ZIP archive of only a specific folder within that branch?

like image 448
M. Wood Avatar asked Mar 13 '26 01:03

M. Wood


1 Answers

You can't get an archive for a specific file or folder.

But you can do something similar which might help you:

  • Get file from repository

  • List repository tree

like image 154
Mostafa Fakhraei Avatar answered Mar 16 '26 14:03

Mostafa Fakhraei



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!