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

Issues
  • 上传报错

    上传报错

    错误日志:

    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
  • 同学,您这个项目引入了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
  • 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
  • 能否支持上传剪贴板中的.png文件

    能否支持上传剪贴板中的.png文件

    我目前在搭配obsidian(基于markdown的笔记软件)使用upgit, 所以很希望upgit能够实现批量处理图片. 比如将某一文件夹下的所有本地图片批量上传并将所有的url导出到剪贴板.

    所以现场截图进行上传获取链接对我而言不太够用, 最好能支持将本地图片文件复制到剪贴板中然后进行上传然后再返回url至剪贴板. 我有尝试复制单一图片文件到剪贴板然后使用upgit上传, 失败的反馈信息是当前剪贴板中没有图像或格式不支持. 图片

    总而言之, 就是希望增加对本地图片通过剪贴板的处理, 如果能支持对本地图片的批量处理那就更好了.

    opened by XMB-7 4
  • panic: clipboard: cannot use when CGO_ENABLED=0

    panic: clipboard: cannot use when CGO_ENABLED=0

    請問:是macOS需要做權限方面的設定嗎?應如何解決?

    [18:36:32] jerry ➜ ~/Documents » upgit :clipboard -f markdown-simple
    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(0x12c2fe0?)
    	/home/runner/work/upgit/upgit/main.go:236 +0x66
    main.main()
    	/home/runner/work/upgit/upgit/main.go:99 +0x41b
    [18:40:12] jerry ➜ ~/Documents »
    
    opened by emisjerry 4
Releases(v0.2.16)
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.2k Aug 11, 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 1k Aug 10, 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 123 Jul 5, 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 66 Jul 20, 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 Jun 8, 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 23 Jul 27, 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 Jul 10, 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 227 Jul 27, 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.5k Aug 4, 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 20 Aug 6, 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 124 Jul 3, 2022