Upgit - Upgit helps you simply upload any file to your Github repository and then get a raw URL for it

Overview

upgit

Upgit helps you simply 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.

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.exe

Rename it to upgit (For Windows users, upgit.exe), save it to somewhere you like.

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

./upgit -h

Upload anything to git and then get its link.
For more information: https://github.com/pluveto/upgit

Usage: upgit.exe [--target-dir TARGET-DIR] [--verbose] [--size-limit SIZE-LIMIT] FILE [FILE ...]

Positional arguments:
  FILE

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          will output more details to help developers
  --size-limit SIZE-LIMIT, -s SIZE-LIMIT
                         in bytes. overwrite default size limit (5MiB). 0 means no limit
  --help, -h             display this help and exit

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.

Now enjoy it.

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

image-20220128204418723

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
-- {unix_ts} -- Unix timestamp in second. Like 1643373370.
--- {ext} -- Extension like .png, and empty when the original file has no extension
-- {file_name} -- Original file base name like demo (without extension)
-- {file_name_hash} -- MD5 Hash in hex of {file_name}

Here is a simplist sample config file:

pat = "ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
rename = "{year}/{month}/upgit_{year}{month}{day}_{unix_ts}{ext}"
repo = "repo-name"
username = "username"

Todo

[x] Upload to specific folder

[ ] Upload and get raw URL

Comments
  • 上传报错

    上传报错

    错误日志:

    2022-04-22 00:38:06.977034861 +0800 CST m=+0.000697220[INFO ] Started
    2022-04-22 00:38:06.977117796 +0800 CST m=+0.000780054[ERROR] abort: $HOME is not defined
    goroutine 1 [running]:
    runtime/debug.Stack()
    	/Users/runner/hostedtoolcache/go/1.18.0-beta1/x64/src/runtime/debug/stack.go:24 +0x65
    github.com/pluveto/upgit/lib/xlog.Verbose.Log({0x38?, 0x61?, {0xc0000160f0?, 0xc000091c80?}, 0x40ce47?}, {0x71bc87, 0x8}, {0xc000091ca0?, 0xc000091cc8?}, {0x0, ...})
    	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:55 +0x12a
    github.com/pluveto/upgit/lib/xlog.Verbose.Error(...)
    	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:44
    github.com/pluveto/upgit/lib/xlog.AbortErr({0x7a6000?, 0xc000020f80?})
    	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:93 +0xf9
    main.loadConfig(0x957160)
    	/Users/runner/work/upgit/upgit/main.go:191 +0x8f
    main.mainCommand()
    	/Users/runner/work/upgit/upgit/main.go:49 +0x35
    main.main()
    	/Users/runner/work/upgit/upgit/main.go:40 +0x7b
    
    opened by inkss 7
  • mac上从剪贴板上传一直提示“failed: no image in clipboard or unsupported format”

    mac上从剪贴板上传一直提示“failed: no image in clipboard or unsupported format”

    但是实际剪贴板是有图片的

    2022-02-21 16:41:51.043596 +0800 CST m=+0.000626072[INFO ] Started
    2022-02-21 16:41:51.050874 +0800 CST m=+0.007904413[ERROR] abort: failed: no image in clipboard or unsupported format
    goroutine 1 [running]:
    runtime/debug.Stack()
    	/Users/runner/hostedtoolcache/go/1.18.0-beta1/x64/src/runtime/debug/stack.go:24 +0x65
    github.com/pluveto/upgit/lib/xlog.Verbose.Log({0xc0?, 0x63?, {0xc00001e198?, 0xc000079860?}, 0xc000127e40?}, {0x4323438, 0x8}, {0xc000016400?, 0x33?}, {0x0, ...})
    	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:55 +0x12a
    github.com/pluveto/upgit/lib/xlog.Verbose.Error(...)
    	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:44
    github.com/pluveto/upgit/lib/xlog.AbortErr({0x43ad4c0?, 0xc00004d0b0?})
    	/Users/runner/work/upgit/upgit/lib/xlog/verbose.go:93 +0xf9
    main.loadClipboard()
    	/Users/runner/work/upgit/upgit/main.go:360 +0x231
    main.mainCommand()
    	/Users/runner/work/upgit/upgit/main.go:53 +0x85
    main.main()
    	/Users/runner/work/upgit/upgit/main.go:39 +0x7b
    
    opened by goxofy 5
  • Upload clipboard fail on mac

    Upload clipboard fail on mac

    upgit :clipboard -V

    [TRACE] LocalPaths = [':clipboard']
            TargetDir = ''
            Verbose = true
            Wait = false
            Clean = false
            Raw = false
            NoLog = false
            Uploader = ''
            OutputType = 'stdout'
            OutputFormat = 'url'
            ApplicationPath = ''
    [TRACE] default_uploader = 'github'
            rename = '{year}/{month}/upgit_{year}{month}{day}_{unixts}{ext}'
            [output_formats]
            bbcode = '[img]{url}[/img]'
            html = '<img src="{url}" />'
            markdown = '![{url_fname}]({url})'
            markdown-simple = '![]({url})'
            url = '{url}'
    panic: clipboard: cannot use when CGO_ENABLED=0
    
    goroutine 1 [running]:
    golang.design/x/clipboard.initialize(...)
    	/home/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard_nocgo.go:9
    golang.design/x/clipboard.Init(...)
    	/home/runner/go/pkg/mod/golang.design/x/[email protected]/clipboard.go:102
    main.loadClipboard()
    	/home/runner/work/upgit/upgit/main.go:343 +0xa4
    main.mainCommand()
    	/home/runner/work/upgit/upgit/main.go:53 +0x9c
    main.main()
    	/home/runner/work/upgit/upgit/main.go:39 +0xb8
    
    opened by xieyx 4
  • toml配置文件必须将[]方括号整行删掉才可正常使用

    toml配置文件必须将[]方括号整行删掉才可正常使用

    我不知道是由于我哪里出了配置问题,但是在不注释掉全部的方括号行前,我是无法使用的,错误提示如下: incorrect config: Username: zero value, Repo: zero value, PAT: zero value 疑似 [uploaders.github] 这一行出现问题

    opened by ocean0117 3
  • win11 upgitrc 不可用

    win11 upgitrc 不可用

    Upgit v0.2.16

    用户目录下 .upgit.config.toml 可以正常使用

    PS C:\Users\xxx> mv .\.upgit.config.toml .\.config\upgitrc 移动到 .config\upgitrc 后报错

    no config file found

    scoop 也在用 .config 目录做配置,想把配置文件汇聚到一起。

    opened by 4ft35t 2
  • 同学,您这个项目引入了47个开源组件,存在2个漏洞,辛苦升级一下

    同学,您这个项目引入了47个开源组件,存在2个漏洞,辛苦升级一下

    检测到 pluveto/upgit 一共引入了47个开源组件,存在2个漏洞

    漏洞标题:Go SSH拒绝服务漏洞
    缺陷组件:golang.org/x/[email protected]
    漏洞编号:CVE-2020-9283
    漏洞描述:Go SSH是一个使用go语言开发的极度简洁的ssh工具,用于远程管理linux、unix等机器。
    Go SSH存在拒绝服务漏洞,该漏洞源于网络系统或产品未对输入的数据进行正确的验证,攻击者可利用该漏洞导致拒绝服务条件,拒绝向合法用户提供服务。
    国家漏洞库信息:https://www.cnvd.org.cn/flaw/show/CNVD-2020-14300
    影响范围:(∞, 0.0.0-20200220183623-bac4c82f6975)
    最小修复版本:0.0.0-20200220183623-bac4c82f6975
    缺陷组件引入路径:github.com/pluveto/[email protected]>golang.org/x/[email protected]>golang.org/x/[email protected]>golang.org/x/[email protected]
    

    另外还有2个漏洞,详细报告:https://mofeisec.com/jr?p=ae53d1

    opened by ghost 2
  • 添加中文配置模板

    添加中文配置模板

    1.config.sample.toml Misnomer: change "warehouse" to "repository" Add more comments 2.新增中文配置例子文件 : config.sample.zh-CN.toml 3.修改README.zh-CN.md文件中的配置文件超链接"config.sample.toml"为"config.sample.zh-CN.toml"

    opened by mxlt02 2
  • 关于上传非图片文件

    关于上传非图片文件

    • 在picgo-core中,你复制一个文件,然后就能快捷键上传到网盘。

    local file path to upload. :clipboard for uploading clipboard image.

    • 看意思是说upgit是无法上传剪贴板中除了图片以外的其他文件,只能用命令行upgit abc.* 方式上传其他格式文件。

    • 问题:有没有更方便一点的方法,比如批处理之类的吧,让人不用每次都要输入一次路径命令。

    opened by kevzcr 0
  • fix: `default_uploader` is not working when using custom uploader

    fix: `default_uploader` is not working when using custom uploader

    > upgit --verbose .\111.jpg
    [TRACE] LocalPaths = ['.\111.jpg']
            TargetDir = ''
            Verbose = true
            Wait = false
            Clean = false
            Raw = false
            NoLog = false
            Uploader = ''
            OutputType = 'stdout'
            OutputFormat = 'url'
            ApplicationPath = ''
    [TRACE] default_uploader = 'smms'
            rename = '{year}/{month}/upgit_{year}{month}{day}_{unixts}{ext}'
            [output_formats]
            bbcode = '[img]{url}[/img]'
            html = '<img src="{url}" />'
            markdown = '![{url_fname}]({url})'
            markdown-simple = '![]({url})'
            url = '{url}'
    [INFO ] uploader: smms
    [TRACE] found file smms.jsonc
    [ERROR] abort: unknown uploader:
    unknown uploader:
    
    opened by hoilc 0
  • typora使用smms图床报错

    typora使用smms图床报错

    open C:\Users\zzz\AppData\Roaming\Typora\extensions: The system cannot find the file specified.

    这是要自己新建一个文件夹extensions,然后下载代码库里面对应的比如smms.jsonc放进去?readme里面没写啊。

    而且做了以上步骤还是不行,Post "https://sm.ms/api/v2/upload": net/http: TLS handshake timeout,我猜是被樯了?

    smms.jsonc里面换成smms.app域名也不行,换成"url": "https://smms.app/api/v2/upload",,报错Failed: rawUrl path is not valid: for path data.url, key data not found

    到底该怎么办,整了一下午快自闭了。

    opened by MC-dusk 0
  • 上传有大小限制吗?

    上传有大小限制吗?

    传不上去,日志如下:

    2022-09-14 08:51:07.915924 +0800 CST m=+0.000319876[INFO ] Started 2022-09-14 08:51:07.925968 +0800 CST m=+0.010363584[ERROR] abort: invalid file to upload /var/folders/hc/my4442h94j5983yx1xdkrsk00000gn/T//upgit_tmp_1663116667916137.png: file size is larger than 5242880 bytes goroutine 1 [running]: runtime/debug.Stack() /Users/runner/hostedtoolcache/go/1.18.0-beta1/x64/src/runtime/debug/stack.go:24 +0x68 github.com/pluveto/upgit/lib/xlog.Verbose.Log({0xc8?, 0x5d?, {0x14000156210?, 0x10?}, 0x140001a8000?}, {0x1023575ad, 0x8}, {0x140001aa000?, 0x1023526cc?}, {0x0?, ...}) /Users/runner/work/upgit/upgit/lib/xlog/verbose.go:55 +0xf8 github.com/pluveto/upgit/lib/xlog.Verbose.Error(...) /Users/runner/work/upgit/upgit/lib/xlog/verbose.go:44 github.com/pluveto/upgit/lib/xlog.AbortErr({0x102458c68?, 0x1400011aee0?}) /Users/runner/work/upgit/upgit/lib/xlog/verbose.go:93 +0xe8 main.validArgs() /Users/runner/work/upgit/upgit/main.go:182 +0x310 main.mainCommand() /Users/runner/work/upgit/upgit/main.go:57 +0xa0 main.main() /Users/runner/work/upgit/upgit/main.go:40 +0xb8

    这种情况如何处理呢?支持修改大小上限值吗

    opened by cksspk 1
Releases(v0.2.17)
Owner
null
A simply upload fileserver for fun

Filebus A simply upload fileserver for fun Build Binary: go build -o filebus . Docker docker build . -t n0vad3v/filebus:lastest Usage Filebus will b

Nova Kwok 0 Dec 14, 2021
Provide an upload endpoint that stores files on pinata and returns a json response with the uploaded file pinata url

Purpose Build a template repository to get to coding as quickly as possible, by starting from a common template which follows the guidelines here Feat

Dathan Vance Pattishall 0 Dec 30, 2021
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic repair.(similar fastdfs).

中文 English 愿景:为用户提供最简单、可靠、高效的分布式文件系统。 go-fastdfs是一个基于http协议的分布式文件系统,它基于大道至简的设计理念,一切从简设计,使得它的运维及扩展变得更加简单,它具有高性能、高可靠、无中心、免维护等优点。 大家担心的是这么简单的文件系统,靠不靠谱,可不

小张 3.3k Dec 5, 2022
Plik is a scalable & friendly temporary file upload system ( wetransfer like ) in golang.

Want to chat with us ? Telegram channel : https://t.me/plik_root_gg Plik Plik is a scalable & friendly temporary file upload system ( wetransfer like

root.gg 1.1k Dec 1, 2022
Ghostinthepdf - This is a small tool that helps to embed a PostScript file into a PDF

This is a small tool that helps to embed a PostScript file into a PDF in a way that GhostScript will run the PostScript code during the

Emil Lerner 134 Nov 9, 2022
Download an upload large files to Google Drive (API v3)

gdriver gdriver is a command-line tool, written in Go, used for uploading and downloading large personal files from Google Drive (API v3). The tool pr

Marcin Tojek 67 Nov 30, 2022
upload to gdrive include shared drive

gdrive_uploader upload to gdrive include shared drive How to get go get github.com/heat1024/gdrive_uploader About credential You must set your client

ryu 3 Oct 6, 2022
Small gh extension that suggests issues to work on in a given GitHub repository

gh contribute being a gh extension for finding issues to help with in a GitHub repository. This extension suggests an issue in a given repository to w

Nate Smith 26 Nov 2, 2022
Get a binary file directly from the Golang source project.

This project aims to provide a way to get binary file from a Golang project easily. Users don't need to have a Golang environment. Server Usage: docke

Rick 3 Nov 18, 2021
revealit is a small binary that helps with the identification of dependencies and their categories

revealit is a small binary that helps with the identification of dependencies and their categories. When you start on a new project, it's always interesting to understand what people have been using.

Gustavo Freitas 4 Aug 29, 2022
Go filesystem implementations for various URL schemes

hairyhenderson/go-fsimpl This module contains a collection of Go filesystem implementations that can discovered dynamically by URL scheme. All filesys

Dave Henderson 235 Nov 26, 2022
File system for GitHub

HUBFS · File System for GitHub HUBFS is a read-only file system for GitHub and Git. Git repositories and their contents are represented as regular dir

Bill Zissimopoulos 1.6k Dec 7, 2022
A rudimentary go program that allows you to mount a mongo database as a FUSE file system

This is a rudimentary go program that allows you to mount a mongo database as a

Jay Goel 1 Dec 29, 2021
Grep archive search in any files on the filesystem, in archive and even inner archive.

grep-archive Grep archive search for string in any files on the filesystem, in archive and even inner archive. Supported archive format are : Tar Form

Michel Prunet 0 Jan 26, 2022
Paste your GitHub Secrets to files

Paste-Secret Paste your GitHub Secrets in files Usage Inputs Required secrets : Secrets ise JSON object array. Holds filename, keys and values which w

Barış Can Yılmaz 8 Feb 25, 2022
Get an embed.FS from inside an embed.FS

embed.FS wrapper providing additional functionality Features Get an embed.FS from an embedded subdirectory Handy Copy(sourcePath, targetPath) method t

Lea Anthony 22 Sep 27, 2022
Generate your cv from a yaml configuration file

Requirements wkhtmltopdf git * Flags -i string path to the webpage (index.html) -o string pdf output path -y string conf

alex 2 Nov 27, 2021
RtxTest - Extract this zip file into your golang development environment

Documentation 1. Clone or extract file extract this zip file into your golang de

Abdul Rauf 1 May 12, 2022
A Go io/fs filesystem implementation for reading files in a Github gists.

GistFS GistFS is an io/fs implementation that enables to read files stored in a given Gist. Requirements This module depends on io/fs which is only av

Jean Hadrien Chabran 126 Oct 14, 2022