从GitHub repo下载单个文件有哪些技巧?
我不想要显示原始文件的URL;对于二进制文件,什么都没有。
http://support.github.com/discussions/feature-requests/41-download-single-file
是否有可能将GitHub用作“下载服务器”?
如果我们决定切换到GoogleCode,是否提供了上述功能?
或者开源项目是否有免费托管和VCS?
从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
其他回答
我的简单方法是:
单击“原始”按钮以获取浏览器上显示的github_csv.csv文件内容。然后创建file.csv并在记事本等文本编辑器中打开它然后从网站复制文件内容并将其粘贴到file.csv上您的文件.csv是github_csv.csv
只需将wget与raw=True参数一起使用
wget "https://github.com/user/repository/blob/master/directory/file_name?raw=True" -O target_path/file_name
有一个名为Enhanced Github的chrome扩展
它将在每个文件的右侧直接添加一个下载按钮。
转到脚本并单击“原始”
然后复制链接并使用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。
为了跟进thomasfuchs所说的,但对于GitHub Enterprise用户,您可以使用以下内容。
curl-H'授权:令牌INSERTACCESSTOKENHERE'-H'接受:application/vnd.github.v3.raw'-O-Lhttps://your_domain/api/v3/repos/owner/repo/contents/path
这里还有API文档https://developer.github.com/v3/repos/contents