[solved] Downloading single file from repo using Curl and authentication withToken

Hello,

I’m trying to download a single file from a repo using Curl and authentication Token.
Using this command results in downloaded file contains metadata in JSON format:

curl -k "https://git.example.com/api/v1/repos/org/scripts/contents/file.sh" -H "accept: application/json" -H "Authorization: token 975906fcxxxxxxxxxxxxxxxxxxxxxxxx"
 -o file.sh

I don’t think -H "accept: application/json" is correct here.

Can you please advise which curl syntax will download file.sh correctly?

THX


Update: this command works as expected
curl -k "https://git.example.com/api/v1/repos/org/scripts/raw/file.sh" -H "accept: application/raw" -H "Authorization: token <TOKEN>" -o [file.sh](http://file.sh/)

1 Like