从GitHub repo下载单个文件有哪些技巧?

我不想要显示原始文件的URL;对于二进制文件,什么都没有。

http://support.github.com/discussions/feature-requests/41-download-single-file

是否有可能将GitHub用作“下载服务器”?

如果我们决定切换到GoogleCode,是否提供了上述功能?

或者开源项目是否有免费托管和VCS?


当前回答

只需将wget与raw=True参数一起使用

wget "https://github.com/user/repository/blob/master/directory/file_name?raw=True" -O target_path/file_name

其他回答

如果您想使用wget从github下载zip文件

wget -O filename.zip https://github.com/downloads/user/repository/filename.zip?raw=true

有关详细信息,请参阅此网站

转到脚本并单击“原始”

然后复制链接并使用aria2c链接下载。

例如:aria2chttps://raw.githubusercontent.com/kodamail/gscript/master/color.gsf

窍门:我想下载的文件是,https://github.com/kodamail/gscript*/blob*/master/color.gsf

只需将链接修改为https://raw.githubusercontent.com/kodamail/gscript/master/color.gsf

删除斜体文本并添加相同格式的粗体文本,这将为您提供正确的链接。

可以与aria2c、wget或curl一起使用,我在这里使用了aria2c。

这就是我刚才所做的。。。

在单独的选项卡中打开原始文件。将整个内容复制到记事本中的新文件中。将文件保存为原来的扩展名

使用我刚才下载的php文件进行测试(在回答时)

我认为新的url结构是raw.giturl,例如:

git文件

raw

GitHub Mate可以轻松下载单个文件,只需单击图标即可下载,目前它只能在Chrome上运行。