CLIでGistにファイルをアップロード

概要

GitHubスニペットサービスのGistにターミナルからアップロードする手順です。

インストール

brew install gist



初期設定

gist --login

以下のようにログインプロンプトが出ますのでログインします。

$ gist --login
Obtaining OAuth2 access_token from github.
GitHub username: 
GitHub password:
2-factor auth code: 

Success! https://github.com/settings/tokens
$



使い方

gist -p -f "hello.txt" -d "Hello World" hello.txt

オプション

  • -p シークレットモードでアップロード
  • -f アップロードした際に表示されるファイル名
  • -d Description
  • 最後のhello.txt アップロード対象ファイルを指定


成功すると以下のようにURLが表示されます。

$ gist -p -f "hello.txt" -d "Hello World" hello.txt
https://gist.github.com/xxxxx
$