Help us shape the future of Go! Take the 2026 Go Developer Survey

ghupload

command module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 1 Imported by: 0

README

ghupload

build

CLI to upload a file to a github repository through github's REST API. The file will be either created or overwritten.

Installation

Downloadable binaries are available from the releases page.

Setup

Create a Github personal access token and store it in one of the following ways:

  • GITHUB_TOKEN environment variable
$ export GITHUB_TOKEN="your-personal-access-token"
  • In a github-token file. See help message for the upload command for the location on your system. On Linux this is usally $HOME/.config/ghupload/github-token, on MacOS $HOME/Library/Application/ghupload/github-token and %AppData%/ghupload/github-token on Windows.

  • Provide a token parameter to the upload command, pointing to a file containing the access token.

Usage

Usage:
  ghupload upload -m <commit-msg> [-b <branch>] [-t <token-file>] <local-path> <remote-url>

Flags:
  -b, --branch string    Commit to branch (default branch if empty)
  -m, --message string   Commit message (required)
  -t, --token string     File to read token from (default /home/USER/.config/ghupload/github-token)

local-path is either a path to a local file or "-" for STDIN.

remote-url can be one of the following formats and has to include the repository owner, the repository and the path to the file inside the repository:

Command prints the commit SHA on success.

Examples
  • Upload file
$ ghupload upload -m "commit msg" README.md invit/ghupload/README.md
b6cbb5b2ea041956c4ac8da17007f95d2312a461
  • Upload data from STDIN
$ ghupload upload -m "commit msg" - invit/ghupload/README.md
this is the new 
content 
of the file
^D
3be39e60c3ae44faa40f4efc31241f3564c396f1

Build

On Linux:

$ git clone github.com/invit/ghupload 
$ cd ghupload
$ make 

License

ghupload is licensed under the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL