如何使用curl从git托管站点下载git存储库中的原始文件?

如何使用curl从git托管站点下载git存储库中的原始文件?,git,github,Git,Github,我正在尝试从Git存储库获取文件。我以下是本链接中的示例: 但是,上面的链接是针对GitLab的,我需要为GitHub上的一个文件执行此操作 因此,使用Postman和我的个人访问令牌,我调用以下API链接: "https://github.com/xxxxxx/blob/master/abc-def/loginservicedapr-hpa.yaml?ref=master" 但是我得到了一个大的html文件作为响应,我的实际文件内容嵌入到html主体中。我还尝试调用以下url: "https

我正在尝试从Git存储库获取文件。我以下是本链接中的示例:

但是,上面的链接是针对GitLab的,我需要为GitHub上的一个文件执行此操作

因此,使用Postman和我的个人访问令牌,我调用以下API链接: "https://github.com/xxxxxx/blob/master/abc-def/loginservicedapr-hpa.yaml?ref=master"

但是我得到了一个大的html文件作为响应,我的实际文件内容嵌入到html主体中。我还尝试调用以下url: "https://github.com/xxxxxx/blob/master/abc-def/loginservicedapr-hpa.yaml/raw?ref=master"

但它给出了同样的回应。请提供帮助。

对于Github,您可以执行以下操作:

curl \                                                                               
  -H "Accept: application/vnd.github.VERSION.raw" \
  https://api.github.com/repos/{owner}/{repo}/contents/{path}\?ref\=<ref, e.g. master>
和。

对于Github,您可以执行以下操作:

curl \                                                                               
  -H "Accept: application/vnd.github.VERSION.raw" \
  https://api.github.com/repos/{owner}/{repo}/contents/{path}\?ref\=<ref, e.g. master>

和。

Gitlab或github?github删除了错误的标记my bad Gitlab或github?github删除了错误的标记my bad