GitHub

gh

March 19, 2023
gh, GitHub

gh # gh is the official command-line tool for GitHub. It provides an easy-to-use interface for managing pull requests, issues, repositories, and more. Install # macOS # % brew install gh Log in # Get new token on GitHub # Access https://github.com/settings/tokens Click Generate new token > Generate new token (classic) Fill in some fields in a form (enter any name in Note) Click Generate new token Copy new token Log in on the terminal # # Login to Github % gh auth login ? ...

ghq

March 19, 2023
ghq, GitHub

ghq # ghq is a command-line tool for managing local clones of Git repositories. Install ghq # % brew install ghq Configure # % ghq root /path/to/your/dir/ % git config --global ghq.root /path/to/your/dir/ How to use ghq command # List repositories ghq list Clone a repository ghq get github.com/foo/bar Delete a repository ghq delete github.com/foo/bar

Multiple GitHub Account on 1 PC

January 19, 2023
GitHub, Multiple Account, Configuration

複数のGitHubアカウントを1つのPCで使用 # 概要 # 複数のGitHubアカウントを1つのPC内で自動的に切り分ける方法を説明 以下のディレクトリ account1 と account2 に異なるGitHubアカウントを設定 ディレクトリ構成 ~/source └── github ├── account1 │ ├── repository1 │ └── repository2 └── account2 ├── repository3 └── repository4 1. 公開鍵と秘密鍵を作成 # まず account1 用の公開鍵と秘密鍵を作成 ssh-keygen のオプション # option 説明 備考 -t 鍵の暗号化方式 今回は強度の高い ed25519 を選択 -P パスワード 今回は空を指定 -C 任意のコメント 今回はGitHubのメールアドレスを指定 -f 出力するファイル名 今回は id_暗号化方式_任意の識別子 を指定 ssh-keygen で作成 # 内容 $ cd ~/.ssh $ ssh-keygen -t [暗号化方式] -P '' -C [追加するアカウントのメール] -f [秘密鍵のファイル名] 実例 ...