我可以使用下面的命令克隆一個帶有用戶名和密碼的私有倉庫
git clone https://some-git-lab-token:[email protected]/foo/bar.git
我不知道是否有可能curl或wget從相同的回購使用相同的憑據一個原始檔案some-git-lab-token:someHash
一個示例 gitlab 原始檔案 url 如下
https://gitlab.com/athos.oc/lodash-has-plugin/-/raw/master/.eslintrc.json
我試圖按如下方式卷曲單個檔案但失敗了
curl https://some-git-lab-token:[email protected]/foo/bar/-/raw/master/testing.js
我得到的結果如下
<html><body>You are being <a href="https://git.xxx.com/users/sign_in">redirected</a>.</body></html>
uj5u.com熱心網友回復:
要通過 curl 下載存盤庫檔案,您需要使用存盤庫檔案 API 端點。
使用您的示例https://gitlab.com/athos.oc/lodash-has-plugin/-/raw/master/.eslintrc.json,將變成:
https://gitlab.com/api/v4/projects/30349314/repository/files/.eslintrc.json?ref=master
但是,API 身份驗證不包括用戶名和密碼作為可用的身份驗證方法,因此您需要使用令牌(或會話 cookie)。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/353810.html
上一篇:使用bash-c逐行決議
下一篇:無法將特定日期時間字串轉換為日期
