介绍
upgit 可以快捷地将文件上传到 Github 仓库并得到其直链。简洁跨平台,不常驻内存。
特点:
- 支持多平台,包括 Linux、Windows 和 macOS
- 支持多种上传器
- 不限制文件类型
- 支持从剪贴板上传
- 自定义自动重命名规则 (包括路径)
- 可通过替换规则实现 CDN 加速
- 可通过环境变量配置
- 将 URL 输出到标准输出/剪贴板,支持 Markdown 格式
支持平台:
安装
从这里下载系统对应的二进制版本,这里以 macOS 为例。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| # 新建目录
mkdir ~/.local/bin/upgit
cd ~/.local/bin/ssupgit
# 下载 v0.2.18 版本
wget --output-document upgit https://github.com/pluveto/upgit/releases/download/v0.2.18/upgit_macos_amd64
# 添加可执行权限
chmod a+x ./upgit
# 添加到 PATH 中
## bash
echo 'export PATH="${PATH}:${HOME}/.local/bin/upgit"' >> ~/.bashrc"
## zsh
echo 'export PATH="${PATH}:${HOME}/.local/bin/upgit"' >> ~/.zshrc"
# 新建配置文件
touch config.toml
|
配置文件 config.toml 在程序的同目录下,配置参考这里。
实例
1
2
| $ upgit ~/poe.png
https://raw.githubusercontent.com/shangzongyu/blog-image/main/hashnode/2023/upgit_20231102_poe.png
|
和 Typora 集成
配置很简单,只需要指定 upgit 所在的目录即可。

参考 https://support.typora.io/Upload-Image/#image-uploaders