Introduction
You can use Copilot to get answers to coding-related questions, such as how best to code something, how to fix a bug, or how someone else's code works. For full details of what Copilot can do, see What is GitHub Copilot?.
Instructions for using Copilot differ depending on where you are using it. This version of the quickstart is for GitHub. Click the tabs above for instructions on using Copilot in other environments.
GitHub Copilot にサインアップする
Copilot を使うには、Copilot プランにアクセスできる個人用の GitHub アカウントが必要です。 次のことを実行できます。
- Copilot Free から始めて、プランをサブスクライブしないで限られた機能を調べます。
- Copilot Pro または Copilot Pro+ にアップグレードすると、さらに多くの機能、モデル、リクエストの制限のロックが解除されます。
GitHub Copilot のさまざまなプランの詳細については、「Plans for GitHub Copilot」を参照してください。
Asking your first question
-
On GitHub, navigate to a repository and open a file.
-
Click the Copilot icon () at the top right of the file view.
-
Type a question in the "Ask Copilot" box at the bottom of the chat panel and press Enter.
For example, you could enter:
- Explain this file.
- How could I improve this code?
- How can I test this code?
Copilot responds to your request in the panel.
-
You can continue the conversation by asking a follow-up question. For example, you could type "tell me more" to get Copilot to expand on its last comment.
Other questions you can ask
There are many more things you can do with GitHub Copilot Chat in GitHub. For example:
- Ask a general question about software development
- Ask exploratory questions about a repository
- Ask a question about a knowledge base
- Find out about the changes in a pull request
- Ask a question about a specific issue or commit
For more information, see Asking GitHub Copilot questions in GitHub.
Next steps
- Find out more about GitHub Copilot Chat - See Asking GitHub Copilot questions in your IDE.
- Get Copilot code completion suggestions in an IDE - See Getting code suggestions in your IDE with GitHub Copilot.
- Learn how to write effective prompts - See Prompt engineering for Copilot Chat.
- Use Copilot on your mobile device - See Asking GitHub Copilot questions in GitHub Mobile.
- Use Copilot on the command line - See Using GitHub Copilot in the command line.
GitHub Copilot では、エディターでの入力時にコーディングの提案が提供されます。 また、コーディングに最適な方法、バグの修正方法、他のユーザーのコードのしくみなど、Copilot コーディング関連の質問をすることもできます。 Copilot でできることの詳細については、「What is GitHub Copilot?」を参照してください。
Instructions for using Copilot differ depending on where you are using it. This version of the quickstart is for Windows Terminal. Click the tabs above for instructions on using Copilot in other environments.
GitHub Copilot にサインアップする
Copilot を使うには、Copilot プランにアクセスできる個人用の GitHub アカウントが必要です。 次のことを実行できます。
- Copilot Free から始めて、プランをサブスクライブしないで限られた機能を調べます。
- Copilot Pro または Copilot Pro+ にアップグレードすると、さらに多くの機能、モデル、リクエストの制限のロックが解除されます。
GitHub Copilot のさまざまなプランの詳細については、「Plans for GitHub Copilot」を参照してください。
Prerequisites
- Windows Terminal Canary. Terminal Chat is only available in Windows Terminal Canary.
Use Copilot in Terminal Chat
After you've installed Windows Terminal Canary, you can use Copilot in Terminal Chat to ask command line-related questions.
-
Open Settings from the dropdown menu.
-
Go to the Terminal Chat (Experimental) setting.
-
Under Service Providers, select GitHub Copilot and Authenticate via GitHub to sign in.
Chat with GitHub Copilot
メモ
Organization を介して GitHub Copilot にアクセスできる場合、organization の所有者が GitHub Copilot in the CLI を無効にしていると、Windows Terminal で GitHub Copilot を使用することはできません。 「Managing policies for Copilot in your organization」をご覧ください。
-
Open Terminal Chat (Experimental) in the dropdown menu.
-
In the Terminal Chat chat window, type
how do i list all markdown files in my directory
then press Enter.Copilot's answer is displayed below your question.
-
Click on an answer to insert it to the command line.
Next steps
- Copilot コード補完の詳細を確認する - 「Getting code suggestions in your IDE with GitHub Copilot」を参照してください。
- GitHub Copilot Chat の詳細を確認する - 「Asking GitHub Copilot questions in your IDE」を参照してください。
- 有効なプロンプトを記述する方法 - 「Prompt engineering for Copilot Chat」を参照してください。
- モバイル デバイスで Copilot を使用する - 「Asking GitHub Copilot questions in GitHub Mobile」を参照してください。
- コマンド ラインで Copilot を使用する - 「Configuring GitHub Copilot in the CLI」を参照してください。
- エディターで Copilot を構成する - エディター内から GitHub Copilot を有効または無効にしたり、Copilot 用に独自の優先キーボード ショートカットを作成したりできます。 「Configuring GitHub Copilot in your environment」をご覧ください。
GitHub Copilot では、エディターでの入力時にコーディングの提案が提供されます。 また、コーディングに最適な方法、バグの修正方法、他のユーザーのコードのしくみなど、Copilot コーディング関連の質問をすることもできます。 Copilot でできることの詳細については、「What is GitHub Copilot?」を参照してください。
Instructions for using Copilot differ depending on where you are using it. This version of the quickstart is for Visual Studio Code. Click the tabs above for instructions on using Copilot in other environments.
GitHub Copilot にサインアップする
Copilot を使うには、Copilot プランにアクセスできる個人用の GitHub アカウントが必要です。 次のことを実行できます。
- Copilot Free から始めて、プランをサブスクライブしないで限られた機能を調べます。
- Copilot Pro または Copilot Pro+ にアップグレードすると、さらに多くの機能、モデル、リクエストの制限のロックが解除されます。
GitHub Copilot のさまざまなプランの詳細については、「Plans for GitHub Copilot」を参照してください。
Prerequisites
- Visual Studio Code の最新バージョン。 Visual Studio Code のダウンロード ページを参照してください。
- Visual Studio Code での GitHub にサイン インします。 認証に issue が発生した場合は、「Troubleshooting issues with GitHub Copilot Chat」を参照してください。
Chat with GitHub Copilot
After you've installed the GitHub Copilot extension, you can ask Copilot coding-related questions.
メモ
Organization を介して GitHub Copilot にアクセスできる場合、organization 所有者 が会話を無効にしている場合、GitHub Copilot Chat を使用することはできません。 「Managing policies for Copilot in your organization」をご覧ください。
-
Open an existing code file.
-
Open the Chat view from the Activity Bar.
-
At the bottom of the chat view, in the chat input field, type:
explain this file
. -
Press Enter.
Copilot replies in the chat view.
-
In the editor, select one or more lines of code that are not commented.
-
In the chat input field, type:
add comments to these lines
. -
If you like the comments that Copilot suggests, hover over the suggested code in the chat view and click the "Insert at Cursor" icon to replace the selected lines with the suggested code.
Get your first code completion suggestion
The following example uses JavaScript, however other languages will work similarly. GitHub Copilot は、多数の言語とさまざまなフレームワークに対する候補を提示しますが、特に Python、JavaScript、TypeScript、Ruby、Go、C#、C++ に適しています。 GitHub Copilot は、データベースのクエリ生成や、API とフレームワークの候補の生成にも役立ちますし、コード開発としてインフラストラクチャを構築することもできます。
-
Open Visual Studio Code.
-
Visual Studio Code で、新しい JavaScript ( *.js) のファイルを作成します。
-
JavaScript ファイルで、次の関数ヘッダーを入力します。
JavaScript function calculateDaysBetweenDates(begin, end) {
function calculateDaysBetweenDates(begin, end) {
GitHub Copilot will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
-
候補を受け入れるには、Tab キーを押します。
Next steps
- Copilot コード補完の詳細を確認する - 「Getting code suggestions in your IDE with GitHub Copilot」を参照してください。
- GitHub Copilot Chat の詳細を確認する - 「Asking GitHub Copilot questions in your IDE」を参照してください。
- 有効なプロンプトを記述する方法 - 「Prompt engineering for Copilot Chat」を参照してください。
- Use Copilot like a pro - Learn how to write effective prompts for GitHub Copilot. For more information, see Best practices for using GitHub Copilot in VS Code in the Visual Studio Code documentation.
- Get familiar with 次の編集候補 - See About 次の編集候補.
- モバイル デバイスで Copilot を使用する - 「Asking GitHub Copilot questions in GitHub Mobile」を参照してください。
- コマンド ラインで Copilot を使用する - 「Configuring GitHub Copilot in the CLI」を参照してください。
- エディターで Copilot を構成する - エディター内から GitHub Copilot を有効または無効にしたり、Copilot 用に独自の優先キーボード ショートカットを作成したりできます。 「Configuring GitHub Copilot in your environment」をご覧ください。
GitHub Copilot では、エディターでの入力時にコーディングの提案が提供されます。 また、コーディングに最適な方法、バグの修正方法、他のユーザーのコードのしくみなど、Copilot コーディング関連の質問をすることもできます。 Copilot でできることの詳細については、「What is GitHub Copilot?」を参照してください。
Instructions for using Copilot differ depending on where you are using it. This version of the quickstart is for Visual Studio. Click the tabs above for instructions on using Copilot in other environments.
GitHub Copilot にサインアップする
Copilot を使うには、Copilot プランにアクセスできる個人用の GitHub アカウントが必要です。 次のことを実行できます。
- Copilot Free から始めて、プランをサブスクライブしないで限られた機能を調べます。
- Copilot Pro または Copilot Pro+ にアップグレードすると、さらに多くの機能、モデル、リクエストの制限のロックが解除されます。
GitHub Copilot のさまざまなプランの詳細については、「Plans for GitHub Copilot」を参照してください。
Prerequisites
- 互換性のあるバージョンの Visual Studio です。 Visual Studio で GitHub Copilot を使うには、Windows 用の Visual Studio 2022 17.8 以降がインストールされている必要があります。 詳細については、Microsoft ドキュメントの「Visual Studio のインストール」を参照してください。
- Visual Studio Code の GitHub Copilot 拡張機能。 Copilot 拡張機能をインストールする方法については、Microsoft ドキュメントの「Visual Studio で GitHub Copilot をインストールする」を参照してください。
- GitHub アカウントを Visual Studio に追加します。 Microsoft ドキュメントの「Visual Studio のキーチェーンに GitHub アカウントを追加する」を参照してください。
Chat with GitHub Copilot
After you've installed the GitHub Copilot extension, you can ask Copilot coding-related questions.
メモ
Organization を介して GitHub Copilot にアクセスできる場合、organization 所有者 が会話を無効にしている場合、GitHub Copilot Chat を使用することはできません。 「Managing policies for Copilot in your organization」をご覧ください。
-
Open an existing code file.
-
In the Visual Studio menu bar, click View, then click GitHub Copilot Chat.
-
In the Copilot Chat window, type
what does this file do
then press Enter.Copilot's answer is displayed below your question.
-
Select a line of code in the editor.
-
In the Copilot Chat window, type
explain this line
then press Enter.
Get your first code completion suggestion
The following example uses JavaScript, however other languages will work similarly. GitHub Copilot は、多数の言語とさまざまなフレームワークに対する候補を提示しますが、特に Python、JavaScript、TypeScript、Ruby、Go、C#、C++ に適しています。 GitHub Copilot は、データベースのクエリ生成や、API とフレームワークの候補の生成にも役立ちますし、コード開発としてインフラストラクチャを構築することもできます。
-
Open Visual Studio.
-
In Visual Studio, create a new JavaScript (*.js) file.
-
JavaScript ファイルで、次の関数ヘッダーを入力します。
JavaScript function calculateDaysBetweenDates(begin, end) {
function calculateDaysBetweenDates(begin, end) {
GitHub Copilot will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
-
候補を受け入れるには、Tab キーを押します。
Next steps
- Copilot コード補完の詳細を確認する - 「Getting code suggestions in your IDE with GitHub Copilot」を参照してください。
- GitHub Copilot Chat の詳細を確認する - 「Asking GitHub Copilot questions in your IDE」を参照してください。
- 有効なプロンプトを記述する方法 - 「Prompt engineering for Copilot Chat」を参照してください。
- Prompt like a pro - Watch Visual Studio Prompt Engineering with GitHub Copilot on YouTube.
- モバイル デバイスで Copilot を使用する - 「Asking GitHub Copilot questions in GitHub Mobile」を参照してください。
- コマンド ラインで Copilot を使用する - 「Configuring GitHub Copilot in the CLI」を参照してください。
- エディターで Copilot を構成する - エディター内から GitHub Copilot を有効または無効にしたり、Copilot 用に独自の優先キーボード ショートカットを作成したりできます。 「Configuring GitHub Copilot in your environment」をご覧ください。
GitHub Copilot では、エディターでの入力時にコーディングの提案が提供されます。 また、コーディングに最適な方法、バグの修正方法、他のユーザーのコードのしくみなど、Copilot コーディング関連の質問をすることもできます。 Copilot でできることの詳細については、「What is GitHub Copilot?」を参照してください。
Instructions for using Copilot differ depending on where you are using it. This version of the quickstart is for JetBrains IDEs. Click the tabs above for instructions on using Copilot in other environments.
GitHub Copilot にサインアップする
Copilot を使うには、Copilot プランにアクセスできる個人用の GitHub アカウントが必要です。 次のことを実行できます。
- Copilot Free から始めて、プランをサブスクライブしないで限られた機能を調べます。
- Copilot Pro または Copilot Pro+ にアップグレードすると、さらに多くの機能、モデル、リクエストの制限のロックが解除されます。
GitHub Copilot のさまざまなプランの詳細については、「Plans for GitHub Copilot」を参照してください。
Prerequisites
- A compatible JetBrains IDE. Copilot is supported in a large number of JetBrains IDEs. For a full list, see Asking GitHub Copilot questions in your IDE.
- GitHub Copilot プラグイン。 JetBrains Marketplace で「GitHub Copilot プラグイン」を確認してください。 インストール手順については、「Installing the GitHub Copilot extension in your environment」を参照してください。
- JetBrains IDE で GitHub にログイン。 認証手順については、「Installing the GitHub Copilot extension in your environment」を参照してください。
Chat with GitHub Copilot
After you've installed the GitHub Copilot plugin, you can ask Copilot coding-related questions.
メモ
Organization を介して GitHub Copilot にアクセスできる場合、organization 所有者 が会話を無効にしている場合、GitHub Copilot Chat を使用することはできません。 「Managing policies for Copilot in your organization」をご覧ください。
-
Open an existing code file.
-
Open the Copilot Chat window by clicking the Copilot Chat icon at the right side of the JetBrains IDE window.
-
In the Copilot Chat window, type
what does this file do
then press Enter.Copilot's answer is displayed below your question.
-
Select a line of code in the editor.
-
In the Copilot Chat window, type
explain this line
then press Enter.
Get your first code completion suggestion
The following example uses JavaScript, however other languages will work similarly. GitHub Copilot は、多数の言語とさまざまなフレームワークに対する候補を提示しますが、特に Python、JavaScript、TypeScript、Ruby、Go、C#、C++ に適しています。 GitHub Copilot は、データベースのクエリ生成や、API とフレームワークの候補の生成にも役立ちますし、コード開発としてインフラストラクチャを構築することもできます。
-
In your JetBrains editor, create a new JavaScript (*.js) file.
-
JavaScript ファイルで、次の関数ヘッダーを入力します。
JavaScript function calculateDaysBetweenDates(begin, end) {
function calculateDaysBetweenDates(begin, end) {
GitHub Copilot will automatically suggest an entire function body in grayed text. The exact suggestion may vary.
-
候補を受け入れるには、Tab キーを押します。
Next steps
- Copilot コード補完の詳細を確認する - 「Getting code suggestions in your IDE with GitHub Copilot」を参照してください。
- GitHub Copilot Chat の詳細を確認する - 「Asking GitHub Copilot questions in your IDE」を参照してください。
- 有効なプロンプトを記述する方法 - 「Prompt engineering for Copilot Chat」を参照してください。
- モバイル デバイスで Copilot を使用する - 「Asking GitHub Copilot questions in GitHub Mobile」を参照してください。
- コマンド ラインで Copilot を使用する - 「Configuring GitHub Copilot in the CLI」を参照してください。
- エディターで Copilot を構成する - エディター内から GitHub Copilot を有効または無効にしたり、Copilot 用に独自の優先キーボード ショートカットを作成したりできます。 「Configuring GitHub Copilot in your environment」をご覧ください。