You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 14, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+65-54Lines changed: 65 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,28 +11,39 @@ GitHub Copilot can help you code by offering autocomplete-style suggestions. You
11
11
-**Prerequisites**: To use GitHub Copilot you must have an active GitHub Copilot subscription. Sign up for 60 days free [Copilot](https://github.com/settings/copilot)
12
12
-**Timing**: This course is four steps long and can be completed in under an hour
13
13
14
-
<summary><h2> How to start this course!</h2></summary>
15
-
16
-
1. Above these instructions, click **Use this template**.
17
-
2. From the dropdown right-click **Create a new repository** and open the link in a new tab.
18
-

19
-
3. In the new tab, follow the prompts to create a new repository.
1. Right-click **Start course** and open the link in a new tab.
30
+
2. In the new tab, most of the prompts will automatically fill in for you.
20
31
- For owner, choose your personal account or an organization to host the repository.
21
-
- We recommend creating a public repository—private repositories will use [Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
22
-

23
-
4. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.
32
+
- We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
33
+
- Scroll down and click the **Create repository** button at the bottom of the form.
34
+
3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README.
24
35
25
36
<!--endstep0-->
26
37
27
38
<detailsid=1>
28
39
<summary><h2>Step 1: Leverage Codespaces with VS Code for Copilot</h2></summary>
29
40
30
41
_Welcome to " Develop With AI Powered Code Suggestions Using GitHub Copilot and VS Code"! :wave:_
31
-
32
-
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work. It draws context from comments and code to suggest individual lines and whole functions instantly. GitHub Copilot is powered by OpenAI Codex, a generative pretrained language model created by OpenAI.
33
-
42
+
43
+
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work. It draws context from comments and code to suggest individual lines and whole functions instantly. GitHub Copilot is powered by OpenAI Codex, a generative pretrained language model created by OpenAI.
44
+
34
45
**Copilot works with many code editors including VS Code, Visual Studio, JetBrains IDE, and Neovim.**
35
-
46
+
36
47
Additionally, GitHub Copilot is trained on all languages that appear in public repositories. For each language, the quality of suggestions you receive may depend on the volume and diversity of training data for that language.
37
48
38
49
Using Copilot inside a Codespace shows just how easy it is to get up and running with GitHub's suite of [Collaborative Coding](https://github.com/features#features-collaboration) tools.
@@ -43,8 +54,8 @@ Using Copilot inside a Codespace shows just how easy it is to get up and running
43
54
### :keyboard: Activity: Enable Copilot inside a Codespace
44
55
45
56
**We recommend opening another browser tab to work through the following activities so you can keep these instructions open for reference.**
46
-
47
-
Before you open up a codespace on a repository, you can create a development container and define specific extensions or configurations that will be used or installed in your codespace. Let's create this development container and add copilot to the list of extensions.
57
+
58
+
Before you open up a codespace on a repository, you can create a development container and define specific extensions or configurations that will be used or installed in your codespace. Let's create this development container and add copilot to the list of extensions.
48
59
49
60
1. Navigating back to your **Code** tab of your repository, click the **Add file** drop-down button, and then click `Create new file`.
50
61
1. Type or paste the following in the empty text field prompt to name your file.
@@ -65,7 +76,7 @@ Before you open up a codespace on a repository, you can create a development con
65
76
}
66
77
}
67
78
```
68
-
1. Select the option to **Commit directly to the `main` branch**, and then click the **Commit new file** button.
79
+
1. Select the option to **Commit directly to the `main` branch**, and then click the **Commit new file** button.
69
80
1. Navigate back to the home page of your repository by clicking the **Code** tab located at the top left of the screen.
70
81
1. Click the **Code** button located in the middle of the page.
71
82
1. Click the **Codespaces** tab on the box that pops up.
@@ -79,7 +90,7 @@ Before you open up a codespace on a repository, you can create a development con
79
90

80
91
81
92
**Wait about 60 seconds then refresh your repository landing page for the next step.**
82
-
93
+
83
94
</details>
84
95
85
96
<detailsid=2>
@@ -90,70 +101,70 @@ _Nice work! :tada: You created a Codespace using a devcontainer file that instal
90
101
GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. The following samples are in JavaScript, but other languages will work similarly.
91
102
92
103
Let's try this out utilizing Javascript for Copilot.
93
-
104
+
94
105
### :keyboard: Activity: Add a Javascript file and start writing code
95
106
96
-
1. From inside the codespace in the VS Code explorer window, create a new file.
97
-
107
+
1. From inside the codespace in the VS Code explorer window, create a new file.
108
+
98
109
> **Note**:
99
110
> If you closed the Codespace from above, please open it back up or create a new Codespace.
100
-
111
+
101
112
2. Name the file `skills.js`
102
113
3. Verify your new file looks like:
103
114

104
115
4. In the `skills.js` file, type the following function header.
105
-
116
+
106
117
```
107
118
function calculateNumbers(var1, var2)
108
119
```
109
120
GitHub Copilot will automatically suggest an entire function body in grayed text. Below is an example of what you'll most likely see, but the exact suggestion may vary.
110
121

111
122
112
-
123
+
113
124
5. Press `Tab` to accept the suggestion.
114
-
125
+
115
126
### :keyboard: Activity: Push code to your repository from the codespace
116
127
117
128
1. Use the VS Code terminal to add the `skills.js` file to the repository:
118
-
129
+
119
130
```
120
131
git add skills.js
121
132
```
122
133
123
134
2. Next from the VS code terminal stage and commit the changes to the repository:
124
-
135
+
125
136
```
126
137
git commit -m "Copilot first commit"
127
138
```
128
-
139
+
129
140
3. Finally from the VS code terminal push to code to the repository:
130
-
141
+
131
142
```
132
143
git push
133
144
```
134
-
145
+
135
146
**Wait about 60 seconds then refresh your repository landing page for the next step.**
136
-
147
+
137
148
</details>
138
149
139
150
<detailsid=3>
140
151
<summary><h2>Step 3: View the GitHub Copilot tab with multiple suggestions</h2></summary>
141
152
142
153
_Nice work! You just used AI code suggestions within a Javascript file by using GitHub Copilot :sparkles:_
143
-
154
+
144
155
Keep in mind that as you continue to use copilot, you may not want some of the suggestions GitHub Copilot offers. GitHub Copilot will show you multiple suggestions in a new tab.
145
156
146
157
### :keyboard: Activity: Pull the latest code to the Codespace repo.
147
158
148
159
> **Note**
149
160
> Pull MUST be done prior to the next activity.
150
-
161
+
151
162
1. Use the VS Code terminal to pull the latest code:
152
163
153
164
```
154
165
git pull
155
166
```
156
-
167
+
157
168
### :keyboard: Activity: Add another Javascript method and view all suggestions
158
169
159
170
1. From inside the codespace in the VS Code explorer window, create a new file. Note: If you closed the Codespace from above please open it back up or create a new Codespace.
@@ -165,29 +176,29 @@ Keep in mind that as you continue to use copilot, you may not want some of the s
165
176
4. Stop typing and view the Copilot suggestion by hovering over the red squiggly and select the `...`
166
177
5. Click `Open Completions Panel`. Copilot will synthesize around 10 different code suggestions. You should see something like this:
167
178

168
-
6. Find a solution you like and click `Accept Solution`.
179
+
6. Find a solution you like and click `Accept Solution`.
169
180
7. Your `member.js` file will be updated with your solution.
170
-
181
+
171
182
### :keyboard: Activity: Push code to your repository from the codespace
172
183
173
184
1. Use the VS Code terminal to add the `member.js` file to the repository:
174
-
185
+
175
186
```
176
187
git add member.js
177
188
```
178
189
179
190
2. Next from the VS code terminal stage and commit the changes to the repository:
180
-
191
+
181
192
```
182
193
git commit -m "Copilot second commit"
183
194
```
184
-
195
+
185
196
3. Finally from the VS code terminal push to code to the repository:
186
-
197
+
187
198
```
188
199
git push
189
200
```
190
-
201
+
191
202
192
203
**Wait about 60 seconds then refresh your repository landing page for the next step.**
193
204
@@ -198,21 +209,21 @@ Keep in mind that as you continue to use copilot, you may not want some of the s
198
209
199
210
_Nicely done utilizing the Copilot tab!_:partying_face:
200
211
201
-
You now have leveraged the Copilot quick tab auto-suggest as well as the Copilot hub to accept AI generated suggestions.
212
+
You now have leveraged the Copilot quick tab auto-suggest as well as the Copilot hub to accept AI generated suggestions.
202
213
203
214
Now lets see how you can leverage comments to generate Copilot suggestions!
204
215
205
216
### :keyboard: Activity: Pull the latest code to the Codespace repo.
206
217
207
218
> **Note**
208
219
> Pull MUST be done prior to the next activity.
209
-
220
+
210
221
1. Use the VS Code terminal to pull the latest code:
211
222
212
223
```
213
224
git pull
214
225
```
215
-
226
+
216
227
### :keyboard: Activity: Generate Copilot suggested code from comments.
217
228
218
229
1. From inside the codespace in the VS Code explorer window, create a new file. (If you closed the Codespace from above, please open it back up or create a new Codespace.)
@@ -226,30 +237,30 @@ Now lets see how you can leverage comments to generate Copilot suggestions!
226
237
6. Hover over the red squggly and select the `...`
227
238
> **Note**
228
239
> If you don't see the copilot code block suggestion or the red squiggly and the three dots `...`, you can type `control + enter` to bring up the GitHub Copilot completions panel.
229
-
240
+
230
241
7. Click `Open Completions Panel`. Copilot will synthesise around 10 different code suggestions. You should see somethig like this:
231
242

232
-
8. Find a solution you like and click `Accept Solution`.
243
+
8. Find a solution you like and click `Accept Solution`.
233
244
7. Your `comments.js` file will be updated with your solution.
234
-
245
+
235
246
### :keyboard: Activity: Push code to your repository from the codespace
236
247
237
248
1. Use the VS Code terminal to add the `comments.js` file to the repository:
238
-
249
+
239
250
```
240
251
git add comments.js
241
252
```
242
253
243
254
2. Next from the VS code terminal stage and commit the changes to the repository:
244
-
255
+
245
256
```
246
257
git commit -m "Copilot third commit"
247
258
```
248
-
259
+
249
260
3. Finally from the VS code terminal push to code to the repository:
250
-
261
+
251
262
```
252
-
git push
263
+
git push
253
264
```
254
265
255
266
**Wait about 60 seconds then refresh your repository landing page for the next step.**
@@ -271,7 +282,7 @@ Here's a recap of all the tasks you completed:
271
282
* Leverage comments to have Copilot auto-suggest code.
272
283
273
284
### Additional learning and resources
274
-
285
+
275
286
-[Copilot for Individuals](https://docs.github.com/en/copilot/overview-of-github-copilot/about-github-copilot-for-individuals)
276
287
-[Copilot for Business](https://docs.github.com/en/copilot/overview-of-github-copilot/about-github-copilot-for-business)
277
288
-[Getting started with Copilot](https://docs.github.com/en/copilot/getting-started-with-github-copilot/getting-started-with-github-copilot-in-visual-studio-code)
@@ -289,6 +300,6 @@ Here's a recap of all the tasks you completed:
289
300
290
301
---
291
302
292
-
Get help: [TBD-support](TBD-support-link)•[Review the GitHub status page](https://www.githubstatus.com/)
303
+
Get help: [Post in our discussion board](https://github.com/skills/.github/discussions)•[Review the GitHub status page](https://www.githubstatus.com/)
0 commit comments