Skip to content

oe/download-git-userscript

Repository files navigation

Download Github Sub-folder User script

中文说明

You can create your own userscript power by webpack/es6/typescript/etc by starting from this template

If you have any issues with this script, please create an issue on Github

Features

  • download github source code online: allow you to download whole repo, a sub-folder of a repo or a single file online without git clone locally
  • seamless integration: seamless integrated with Github(click file icon in file list to download), and works great with octotree.

Download Github screenshot

Usage

Install a user script manager

To use user scripts you need to first install a user script manager. Which user script manager you can use depends on which browser you use.

Install this user script

Configure DownGit web app(not required)

Due to github api requests rate limit, if you use DownGit frequently, you may failed to download files with it. Then you can click Github Auth button in the center of DownGit to auth your account with this app.

Credits

This script use Downgit(sourcecode) to download github sub-folder. DownGit is forked from MinhasKamal, I just added Github Auth feature. Thanks to MinhasKamal

中文说明

无需克隆GitHub仓库, 一键在线下载 Github仓库子文件夹; 同时还能在源码详情页一键复制源码.

你也可以使用模版 template使用 webpack/es6/typescript/等技术=来创建你自己的 userscript.

如果你使用中遇到任何问题, 欢迎在Github 上提交 issue

功能特性

  • 在线下载Github仓库源码: 你可以在线下载整个仓库、仓库的某个文件夹、单个文件的代码, 无需在机器上使用git clone命令下载完整仓库
  • 无缝集成: 与 GitHub 无缝集成(点击文件列表左侧图标即可直接下载), 看起来就像是原生功能, 与 Github 增强扩展 octotree 也能无缝配合

Download Github screenshot

在线下载Github仓库的文件夹功能使用开源项目 DownGit(源码) 实现. 该项目fork自MinhasKamal, 本人增加了GitHub auth授权功能, auth 授权后, downgit则拥有更多的Github API调用频次, 即可以用于下载更多github文件.

使用说明

安装脚本管理器

Chrome 用户推荐安装浏览器扩展: Tampermonkey 

其他选择可参考: 安装一个用户脚本管理器

安装脚本

点此来安装脚本

DownGit 网站配置(非必须)

因为Github对第三方应用调用API频率有限制, 如果你经常使用DownGit下载文件, 则可能出现下载失败的情况.

此时就建议你点击网站中间的 Github Auth 按钮进行 Auth 授权, 这样 DownGit 可以拥有更多api调用次数, 能下载更多的文件.

develop steps

change settings of chrome

  1. navigate to chrome:https://flags/#allow-insecure-localhost, enable insecure localhost
  2. navigate to chrome:https://extensions/?id=dhdgffkkebhmkfjojejmpbldmpobfkfo(Chrome manage extensions page of Tampermonkey) and enable Allow access to file URLs (you need to manual reload page when dev userscript, see #475 for more detail)

dev

  1. yarn
  2. yarn dev
  3. open https://127.0.0.1:8080/download-git-userscript.proxy.user.js in browser(click Advanced -> proceed if it shows a security warning ) to install the proxy script
  4. dev code, reload github.com webpage after userscript changed

references

  1. Tampermonkey docs