LoginSignup
0
0

More than 3 years have passed since last update.

超簡単に始めるGitHub CLI

Last updated at Posted at 2020-10-15

利用手順

1.GitHub CLIをインストール

ターミナルでbrew install ghを実行する

$ brew install gh

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
box2d                    fleet-cli                libpciaccess             protoc-gen-go-grpc
envoy                    git-hound                matplotplusplus          tfsec
==> Updated Formulae
Updated 508 formulae.

==> Downloading https://homebrew.bintray.com/bottles/gh-1.1.0.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6045fefd30216e3ddde0f473669334727234a0a337
######################################################################## 100.0%
==> Pouring gh-1.1.0.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Summary
🍺  /usr/local/Cellar/gh/1.1.0: 60 files, 16.4MB

2. githubにログインする

ターミナルでgh auth loginを実行する

$ gh auth login

GithubかEnterpriseか聞かれる(環境による)ので選択する

? What account do you want to log into?  [Use arrows to move, type to filter]
> GitHub.com
  GitHub Enterprise Server

認証方法を聞かれる

Webブラウザ or トークンのどちらかを選択する
矢印で選択してEnterをタップする => Webブラウザが起動します。
ここではWebブラウザを利用(簡単)

? How would you like to authenticate?  [Use arrows to move, type to filter]
> Login with a web browser
  Paste an authentication token

ワンタイムコードが発行される

ここでは7536-EAC9がワンタイムコードにあたります。

? How would you like to authenticate? Login with a web browser

! First copy your one-time code: 7536-EAC9
- Press Enter to open github.com in your browser...

起動したWebブラウザ画面

Enter your one-time codeに先ほどターミナル上に表示されたワンタイムコードを入力しContinueをタップする => 認証画面へ遷移する
image.png

認証する

Authorize githubボタンをタップする
image.png

パスワードを入力する

パスワードを入力してConfirm passwordボタンをタップする
image.png

認証完了画面が表示される
image.png

ターミナルに戻る

以下のメッセージが表示されているのでEnterをタップする
✓ Authentication complete. Press Enter to continue...

git protocolを選ぶ

HTTPSかSSHかを矢印で選択します。(ここではHTTPSを利用)

? Choose default git protocol  [Use arrows to move, type to filter]
> HTTPS
  SSH

? Choose default git protocol HTTPS
- gh config set -h github.com git_protocol https
✓ Configured git protocol
✓ Logged in as tkhrname

こちらでgithubへのログインが完了です。

3. プルリクエストを作成する

git checkout -b feature/ブランチ名
git commit --allow-empty -m "Pull request start."
gh pr create --base develop --title "Title of Pull request" --body "This is the first pull request."
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0