• Stars
    star
    531
  • Rank 83,075 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Another upload hub that supports clipboard. It works well with Typora, Snipaste, VSCode.

upgit

Languages: English / 简体中文

Upgit is a native & lightweight tool to helps you upload any file to your Github repository and then get a raw URL for it.

This is also useful with Typora as an image uploader.

Feature

  • Integrate with VSCode via extension
  • Support for Linux, Windows and macOS
  • Upload any file to given remote github repo folder
  • Upload from clipboard
  • Custom auto renaming rules
  • CDN via replacing rules
  • Config via Environment Variable
  • Output URL to stdout/clipboard, supports markdown image format

Supported Upload Extensions

  • Github
  • Gitee
  • Tencent QcloudCOS
  • Qiniu Kodo
  • Upyun
  • Hello
  • Niupic
  • SM.MS
  • Imgur
  • ImgUrl.org
  • CatBox
  • LSkyPro
  • Chevereto
  • ImgBB
  • Cloudinary
  • EasyImage

More: ./upgit ext ls

Get started

Download

Download it from Release.

If you have no idea which to download:

  • For most Windows users, choose upgit_win_amd64.exe
  • For most macOS users, choose upgit_macos_arm64
  • Execute chmod +x upgit if permission is needed

Rename it to upgit (For Windows users, upgit.exe), save it to somewhere you like. To access it from anywhere, add its directory to the PATH environment variable.

Warning: this program doesn't contain an auto-updater. If you need to keep updated, just give upgit a star.

Config

Create config.toml in the same directory of upgit, and fill it in following this sample config file.

Use it

To upload file logo.png with rename rules, execute:

./upgit logo.png
# for windows: .\upgit.exe logo.png

Then you'll see a link to logo.png.

To upload file logo.png to remote folder /my_images/demo, execute:

./upgit logo.png -t /my_images/demo
# for Windows: .\upgit.exe logo.png -t /my_images/demo

For more help, type -h argument


Upload anything to github repo or other remote storages and then get its link.
For more information: https://github.com/pluveto/upgit

Usage: upgit [--target-dir TARGET-DIR] [--verbose] [--size-limit SIZE-LIMIT] [--wait] [--config-file CONFIG-FILE] [--clean] [--raw] [--no-log] [--uploader UPLOADER] [--output-type OUTPUT-TYPE] [--output-format OUTPUT-FORMAT] [--application-path APPLICATION-PATH] FILE [FILE ...]

Positional arguments:
  FILE                   local file path to upload. :clipboard for uploading clipboard image

Options:
  --target-dir TARGET-DIR, -t TARGET-DIR
                         upload file with original name to given directory. if not set, will use renaming rules
  --verbose, -V          when set, output more details to help developers
  --size-limit SIZE-LIMIT, -s SIZE-LIMIT
                         in bytes. overwrite default size limit (5MiB). 0 means no limit
  --wait, -w             when set, not exit after upload, util user press any key
  --config-file CONFIG-FILE, -c CONFIG-FILE
                         when set, will use specific config file
  --clean, -C            when set, remove local file after upload
  --raw, -r              when set, output non-replaced raw url
  --no-log, -n           when set, disable logging
  --uploader UPLOADER, -u UPLOADER
                         uploader to use. if not set, will follow config
  --output-type OUTPUT-TYPE, -o OUTPUT-TYPE
                         output type, supports stdout, clipboard [default: stdout]
  --output-format OUTPUT-FORMAT, -f OUTPUT-FORMAT
                         output format, supports url, markdown and your customs [default: url]
  --application-path APPLICATION-PATH
                         custom application path, which determines config file path and extensions dir path. current binary dir by default
  --help, -h             display this help and exit

Manage extensions:
upgit ext ACTION

Actions:
  ls                     list all downloadable extensions
  my                     list all local extensions
  add smms.jsonc         install SMMS uploader
  remove smms.jsonc      remove SMMS uploader

Use it for Typora

Assuming your upgit program is saved at "C:\repo\upgit\upgit.exe".

Select File > Preferences...

image-20220128204217802

Move to Image. Choose Custom Command as your Image Uploader.

Input upgit program location into Command textbox.

You can click Test Uploader button to make sure it works.

image-20220128204418723

Now enjoy it!

Upload Clipboard Image

Use :clipboard place holder for clipboard image. (Only supports png format)

./upgit :clipboard

Shortcuts for screenshot:

  • On macOS, use Ctrl+Shift+Cmd+4
  • On Linux/Ubuntu, use Ctrl+Shift+PrintScreen
  • On Windows, use Shift+Win+s

Upload Clipboard Files

Note: This feature is only supported on Windows.

Use :clipboard-files or :clipboard-file place holder for clipboard files. Both will upload all files in clipboard.

./upgit :clipboard-files

Because golang doesn't support clipboard file list, so upgit will use APIProxy-Win32 to get clipboard file list. It will be downloaded automatically when you first use this feature.

Save URL to Clipboard

Use --output-type clipboard:

./upgit logo.png --output-type clipboard
# or .\upgit.exe :clipboard -o clipboard

Copy as Markdown format

Add argument --output-format markdown:

./upgit logo.png --output-type clipboard --output-format markdown
# or .\upgit.exe :clipboard -o clipboard -f markdown

Then you'll get a markdown image link in your clipboard like:

![logo.png](!https://cdn.jsdelivr.net/gh/pluveto/upgit/logo.png)

Best practice with AHK

For Windows user:

  1. Install AHK

  2. Create this script upload_clipboard.ahk and run:

    ; Press Ctrl + F9 to upload clipboard image
    ^F9::
    RunWait, "upgit.exe" :clipboard --output-type clipboard --output-format markdown
    return
  3. Then press WinShiftS to take screenshot. CtrlF9 to upload it and get its link to your clipboard!

Compatible with Snipaste

(Windows Only, from v0.1.5) We recently added support for Snipaste bitmap format. Just copy screenshot and upload!

Config Instructions

Key Desc
username Your Github username, like pluveto
repo Your Github repository name, like upgit
branch The branch for saving files, like master or main
pat Personal Access Token. Visit GitHub Docs for more info
rename Renaming rule. Path separator / will create directories if not exists. Supporting:
-- {year} -- Year like 2006
-- {month} -- Month like 01
-- {day} -- Day like 02
-- {hour} -- Hours of current time
-- {minute} -- Minutes of current time
-- {second} -- Seconds of current time
-- {unix_ts} -- Unix timestamp in second. Like 1643373370.
-- {unix_tsms} -- Unix timestamp in microsecond. Like 1644212979622.
--- {ext} -- Extension like .png, and empty when the original file has no extension
-- {fname} -- Original file base name like demo (without extension)
-- {fname_hash} -- MD5 Hash in hex of {fname}
-- {fname_hash4} -- MD5 Hash in hex of {fname}, first 4 digits
-- {fname_hash8} -- MD5 Hash in hex of {fname}, first 8 digits

Here is a simplist sample config file:

rename = "{year}/{month}/upgit_{year}{month}{day}_{unix_ts}{ext}"
[uploaders.github]
pat = "ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
repo = "repo-name"
username = "username"

Config via Environment Variables

  • UPGIT_TOKEN
  • UPGIT_RENAME
  • UPGIT_USERNAME
  • UPGIT_REPO
  • UPGIT_BRANCH

Custome output format

In follwing way:

[output_formats]
"bbcode" = "[img]{url}[/img]"
"html" = '<img src="{url}" />'
"markdown-simple" = "![]({url})"

Placeholder:

  • {url}: URL to image
  • {fname}: Original file basename
  • {url_fname}: File basename from url

Example usage:

# Upload clipboard and save link to clipboard as bbcode format
upgit :clipboard -o clipboard -f bbcode

Todo

  • Upload to specific folder
  • Upload and get raw URL that is not replaced.
  • Upload clipboard image
  • Save uploaded image link to clipboard
  • Upload from link
  • Ignore uploaded file (link input)
  • Upload history

More Repositories

1

Caplos

A tool to squeeze the power of your CapsLock key 一个充分利用你的大小写键的工具
C#
140
star
2

flydav

Setup a tiny webdav server in 30 seconds. Multi-user, path prefix etc. 轻量高效的 WebDav 服务器。
Go
113
star
3

Mathink

一个无需依赖 Latex 的 Latex 风格公式编辑器, 支持用作 Inkscape 插件. Engish trans: inkscape math symbols / formula editor with latex/tex syntax. On LaTex NOT depending
C#
42
star
4

AcgmuseParser

MIDI 转简谱(JE谱)工具
C#
39
star
5

Reading-Large-Scale-Code

A series of posts on how to read code effectively
36
star
6

ShortcutMap

This desktop app helps show shortcuts map for any application quickly. 该工具能够为任何软件显示其快捷键列表
C#
33
star
7

go-cli-boilerplate

A powerful Golang CLI application scaffold integrated with Logrus, arg parser, toml config, testify, Makefile, VSCode and Github Action.
Go
20
star
8

TransMe

长按鼠标回退键划词翻译。
C#
18
star
9

BilibiliEcho

Bilibili 动态同步到 Typecho 的插件
PHP
17
star
10

minico

a simple, header-only stack-less coroutine library implemented in C
C
16
star
11

ankiterm

A command line anki reviewer based on AnkiConnect
Go
12
star
12

AnkiSharing

分享Anki牌组
11
star
13

bpe_v3

基于 BPE 实现的中文分词。优化:预处理,并行计算,多字词,多词表
Python
10
star
14

ZhihuFormulaConvert

zhconv 直接把 Typora 中的公式完美导入知乎。
C#
6
star
15

light-pbft

A lightweight PBFT consensus implementation (Castro & Liskov, 1999)
TypeScript
6
star
16

hugo-crux

HTML
6
star
17

copy-code-as-markdown

A vscode extension helping you copy code with markdown fences and file name.
JavaScript
5
star
18

JeBack

bipubipu 后端重构版
PHP
4
star
19

ImageUp

一个图片上传工具,类似 PicGo 但是更加轻便。A image uploader for typora, works like PicGo but smaller.
C#
4
star
20

upgit-vscode-extension

Upload and insert clipboard image into document with upgit uploader
TypeScript
4
star
21

console-calc

Simple command calculator generated by flex & bison
Yacc
3
star
22

askai

Ask AI like chatgpt from command line
Go
3
star
23

TyporaPort

用来方便把 Typora 的文件导出给静态博客使用。提供转义等功能。都怪 Markdown 公式标准不统一()
C#
2
star
24

GraphicsTablet36Notes

36记智能笔记本第三方驱动程序
REXX
2
star
25

cirno

Cirno is a light-weight php RESTful api framework
PHP
2
star
26

flarum-bbcode-bilibili

Insert Bilibili video to flarum
PHP
2
star
27

MarkdownImageUploader-COS

将 markdown 文件里的本地图片上传到腾讯云对象储存,以便发布到博客。请搭配 Typora 食用。
Python
2
star
28

site-deploy

Go
2
star
29

smelly-code

Python
2
star
30

bilibot

利用哔哩哔哩私信做的机器人(Demo,可发消息)
Go
1
star
31

refcode

A VSCode extension allowing copy selected code and render it using a custom template (like Markdown) to your clipboard.
TypeScript
1
star
32

saxon-c-demo

Python
1
star
33

site-deploy-client

Python
1
star
34

ColorMyTile

A wpf application which helps you custom windows start menu tile for ANY PROGRAM
C#
1
star
35

Pluvet.Replace

批量正则替换工具
C#
1
star
36

IShareEcho

为 Typecho 文章增加漂亮的分享按钮和二维码
PHP
1
star
37

apihub

Expose your computer software operations as api
TypeScript
1
star
38

blog-util

One key release Hugo/Hexo blog. Auto fill meta.
Python
1
star
39

vmlua

Another very simple lua virtual machine designed just for fun
C++
1
star
40

typecho-private

Typecho 全站私有化
PHP
1
star
41

calc-compiler

Rust
1
star
42

dnsr

C
1
star
43

coin-bot

加密货币(BTC/ETH/SOL...)指标自动监测报警系统
Go
1
star
44

harmonica-helper

C#
1
star
45

jsonrpc-cli

A jsonrpc command line tool for devlopment and testing.
Rust
1
star
46

resume

HTML
1
star
47

merkle-tree

Python
1
star
48

foray

A simple hugo theme
HTML
1
star