I tried to use curl with a private token:
curl --head --header "PRIVATE-TOKEN: xxxxxxxxx" -L "https://gitlab.name.com/<group>/<project>/uploads/<hash>/file.tar.gz"
but always redirects to login page
Solution
2020 That was requested with issue 55520, now issue 25838:
(note: Issue 25838 is completed with GitLab 17.2 June 2024)
It’s possible to upload a file using the api (
POST /api/v4/:project_id/uploads) but there is no way to retrieve the uploaded files (it used to be possible using the Private-Token auth and the web route/:namespace_id/:project_id/uploads/:secret/:file_name)Edit by @Andysoiron: It seems to be still possible to retrieve the file using
/:namespace_id/:project_id/uploads/:secret/:file_name
Andy added:
. I tried to reproduce it locally by uploading a file using
POST /projects/:id/uploadsand then retrieving it usingGET /:namespace_id/:project_id/uploads/:url(I took url from the response of the POST request) and it worked.
You can’t use a
Private-Tokenfor auth you need aCookie: _gitlab_sessionbecauseGET /:namespace_id/:project_id/uploads/:secret/:file_namecome from the front-end.
So this is in progress, as part of issue 197361.
Answered By — VonC
Answer Checked By — Clifford M. (FixIt Volunteer)
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0
Learn more How to download file from gitlab project “uploads” via command line
