【发布时间】:2021-02-20 06:48:02
【问题描述】:
我有一个gitlab的内部部署:https://gitlab.corp.mycompany.com/project/account/config-file/repo/blob/long_alphanumeric_numer/my_wanted_file
我想通过命令行下载“my_wanted_file”。它包含配置内容。
我试过了:
curl -o https://gitlab.corp.mycompany.com/project/account/configfile/repo/blob/master/my_wanted_file
wget https://gitlab.corp.mycompany.com/project/account/configfile/repo/blob/master/my_wanted_file
然后我点击“永久链接”并再次尝试:
curl -OL https://gitlab.corp.mycompany.com/project/account/configfile/repo/blob/long_alphanumeric_numer/my_wanted_file
wget https://gitlab.corp.mycompany.com/project/account/configfile/repo/blob/long_alphanumeric_numer/my_wanted_file```
curl 'Private-Token: my_private_token' https://gitlab.corp.mycompany.com/project/account/configfile/repo/blob/long_alphanumeric_numer/my_wanted_file
使用 curl --header 'Private-Token: my_private_token' 加上 url,返回这个消息:
<html><body>You are being
<a href="https://gitlab.corp.my_company.com/users/sign_in">redirected</a>.</body></html>
在所有情况下,我确实得到了一个带有 java 脚本内容的奇怪文件,但从来没有 my_wanted_file 当前在 gitlab 中显示的配置文件内容。
我认为让大家知道我正在通过 okta 连接到这个私有 gitlab 部署是很重要的。不确定这是否会在中间引入一些噪音,因此需要提供不同的命令。
你能指点一下吗?
【问题讨论】:
-
这能回答你的问题吗? How to download a single file from GitLab?
-
使用 --header 和我的私人令牌,顺便说一句,我以前使用过,返回这个消息:你是 gitlab.corp.my_company.com/users/…>
-
因为你没有使用API url。见我上面的回答。
标签: curl command-line gitlab wget okta