利用手順
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
をタップする => 認証画面へ遷移する
認証する
パスワードを入力する
パスワードを入力してConfirm password
ボタンをタップする
ターミナルに戻る
以下のメッセージが表示されているので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."