GitHub:原始文件的URL [英] GitHub: URL to raw files

查看:742
本文介绍了GitHub:原始文件的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些由GitHub托管的Eclipse扩展项目。这些项目还包括相关的更新站点。因此,我需要一个可以使用Eclipse原始数据的URL来下载和安装插件。



我曾经使用这个网址格式

  https:// github.com/USERNAME/PROJECTNAME/raw/BRANCH 

喜欢

  https://github.com/lowcoupling/dono/raw/master 

但是突然停止工作



现在我应该怎么样了?

解决方案

这个URL确实是 https:// raw。 githubusercontent.com/username/projectname ,但它仅适用于文件,而不适用于项目本身(将返回400:无效请求)

  https://raw.githubusercontent.com/username/projectname/branchName/file 

例如:



https://raw.githubusercontent.com/VonC/compileEverything/master/make_e nv.sh



这与项目存档(tarball或zip)下载,它下载完整的repo。

请参阅 pre> GET / repos /:owner /:repo /:archive_format /:ref

with:




  • archive_format string可以是tarball或zipball 。

    默认值:tarball

  • ref string有效的Git引用。

    默认:存储库的默认分支(通常是master)



例如:



https://api.github.com/repos/VonC/compileEverything/zipball/master


I have some Eclipse extension projects hosted by GitHub. These projects also include the related update sites. I thus need an URL to the raw data that Eclipse can use to download and install the plugins.

I used to use this url pattern

https://github.com/USERNAME/PROJECTNAME/raw/BRANCH

like

https://github.com/lowcoupling/dono/raw/master

But it suddenly stopped to work

How am I supposed to to this now!?

解决方案

The url is indeed https://raw.githubusercontent.com/username/projectname, but it only applies to files, not the project itself (which would return 400: Invalid request)

https://raw.githubusercontent.com/username/projectname/branchName/file

For instance:

https://raw.githubusercontent.com/VonC/compileEverything/master/make_env.sh

This is different from a project archive (tarball or zip) download, which does download the full repo.
See get archive link:

GET /repos/:owner/:repo/:archive_format/:ref

with:

  • archive_format string Can be either tarball or zipball.
    Default: tarball
  • ref string A valid Git reference.
    Default: the repository’s default branch (usually master)

For instance:

https://api.github.com/repos/VonC/compileEverything/zipball/master

这篇关于GitHub:原始文件的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆