简体   繁体   中英

Get raw file from repository with curl

I'm using code from gitlab docs for getting xmlfile from repository:

curl --request GET --header 'PRIVATE-TOKEN: MYTOKEN' 'https://gitlab.com/semborfo/tester/raw/COMMIT_HASH/PoliqonSysem.xml'

But then getting

curl: (6) Could not resolve host: MYTOKEN' 
curl: (1) Protocol "'https" not supported or disabled in libcurl

Can u help me with this problem? i have already spent 4 hours for this

curl: (6) Could not resolve host: MYTOKEN'

Seems like there is a trailing space, should be PRIVATE_TOKEN:MY_TOKEN

curl: (1) Protocol "'https" not supported or disabled in libcurl

Sometimes single quote ' are not really liked, try using "

Try this:

curl --request GET --header "PRIVATE-TOKEN: aabbcc" https://sample.gitlab.com/api/v4/projects/5295/repository/files/lib%2Freference%2Fmaven%2Fsettings%2Exml/raw?ref=master

Where aabbcc is your private access token, it has an espace before aabbcc . This command will get content of settings.xml which is in:

myProject(project ID is 5295, branch master)
    -src
    -lib
       |-reference
             |-maven
                 |-settings.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM