有沒有辦法使用 curl 命令將所有檔案嵌入到 gitlab 片段中?
使用以下命令我只得到第一個檔案。
curl -O "https://gitlab.com/-/snippets/2264390/raw"
由于該片段收集了 3 個檔案,因此我想將它們全部下載。
uj5u.com熱心網友回復:
使用片段 API 獲取所有檔案和 URL 的串列。
https://gitlab.com/api/v4/snippets/2264390
SNIPPET_ID=2264390
curl "https://gitlab.com/api/v4/snippets/$SNIPPET_ID" | jq -r .files[].raw_url
https://gitlab.com/-/snippets/2264390/raw/main/grafana.service
https://gitlab.com/-/snippets/2264390/raw/main/install-grafana-loki-promtail.sh
https://gitlab.com/-/snippets/2264390/raw/main/loki-config.yaml
https://gitlab.com/-/snippets/2264390/raw/main/loki.service
https://gitlab.com/-/snippets/2264390/raw/main/promtail-config.yaml
https://gitlab.com/-/snippets/2264390/raw/main/promtail.service
如果需要,您也可以將該輸出通過管道傳輸到xargs它們并卷曲它們。
如果您愿意使用curl代碼片段以外的其他東西,則其作業方式與任何其他存盤庫一樣,并且可以使用 HTTPS/SSH 進行克隆。
git clone https://gitlab.com/snippets/2264390
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/442087.html
上一篇:使用curl使用HTTPPUT方法測驗zip檔案上傳
下一篇:使用python從影像中洗掉空白
