从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或cURL:
单击GitHub repo中的文件名。单击“原始”以显示文件目录在浏览器中复制URL。在命令行中,运行以下任一命令:wget—无检查证书—内容处置https://URL-from-step3/卷曲-LJOhttps://URL-from-step3/再一个:在RHEL7.6中,运行以下命令:wget公司https://URL-from-step3/--输出文档=FILE_NAME
其他回答
您可以复制GitHub文件的内容,然后将其粘贴到文件中。简单!
请使用“{host}/{user}/}repo}/branch}/{file}”的模式。要获得具体示例,请在Python中执行以下操作:
import pandas as pd
host = 'raw.github.com'
user = 'fivethirtyeight'
repo = 'data'
branch = 'master'
file = 'births/US_births_2000-2014_SSA.csv'
url = f'https://{host}/{user}/{repo}/{branch}/{file}'
df = pd.read_csv(url,sep=',',header=0)
df.head()
您链接到的页面回答了第一个问题。GitHub还提供了一个下载工具,用于发布等内容。谷歌代码根本没有Git。GitHub、Google Code和SourceForge是免费托管。SourceForge可能仍然会做CVS。
转到脚本并单击“原始”
然后复制链接并使用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。
如果您想使用wget从github下载zip文件
wget -O filename.zip https://github.com/downloads/user/repository/filename.zip?raw=true
有关详细信息,请参阅此网站