要先安裝 GitHub CLI 才能安裝 GitHub Copilot CLI # 安裝 GitHub CLI 參考: https://github.com/cli/cli#installation winget 到 Mirosoft Store 上可直接安裝 或 https://github.com/microsoft/winget-cli/releases 下載 或 https://learn.microsoft.com/zh-tw/windows/package-manager/winget/ 下載預覽版 或 https://apps.microsoft.com/detail/9nblggh4nns1?SilentAuth=1&wa=wsignin1.0&rtc=1&hl=zh-tw&gl=TW 下載微軟 Store ```shell= # Windows winget install --id GitHub.cli # 💎 winget 升級 GitHub.cli winget upgrade --id GitHub.cli # Mac brew install gh ``` # 登入 GitHub 帳號 ```shell= # 登出帳號 gh auth logout # 登入帳號 gh auth login ``` # 安裝 GitHub Copilot CLI ```shell= # 安装 Copilot in the CLI gh extension install github/gh-copilot # 💎 更新 Copilot in the CLI gh extension upgrade gh-copilot # 測試是否安裝成功 gh copilot --help ``` # 執行解釋命令 ```shell= gh copilot explain "ls 的作用是甚麼? 用中文顯示" ``` # 提供建議(互動模式) ```shell= gh copilot suggest "git 建立 branch" ``` 會有五個選項 Copy command to clipboard (命令複製到剪貼簿) Explain command (解釋命令) Revise command (修改提示詞) Rate reponse (給出回饋)