How to Use GitHub Copilot to Write Code in 2 Hours: A Step-by-Step Guide
How to Use GitHub Copilot to Write Code in 2 Hours: A Step-by-Step Guide
If you're a solo founder or indie hacker, you've probably felt the weight of having to code everything yourself. Learning to code can be overwhelming, and let's be honest—sometimes you just want to get things done without spending weeks mastering every language or framework. Enter GitHub Copilot, an AI-powered coding assistant that can help you write code faster and more efficiently. In this guide, I’ll show you how to set up and use GitHub Copilot in just two hours, so you can start shipping your side projects sooner.
What You’ll Need Before Getting Started
- GitHub Account: If you don’t have one, create a free account at GitHub.
- Visual Studio Code (VS Code): Download and install VS Code, as Copilot works as an extension within it.
- GitHub Copilot Subscription: As of 2026, GitHub Copilot costs $10/month or $100/year after a 30-day free trial.
- Basic Understanding of Programming: While Copilot can help you write code, having some foundational knowledge will make it easier to understand the suggestions.
Step 1: Setting Up GitHub Copilot
-
Install Visual Studio Code: Go to the VS Code download page and install the version for your operating system.
-
Install GitHub Copilot Extension:
- Open VS Code.
- Go to Extensions (or press
Ctrl+Shift+X). - Search for "GitHub Copilot" and click Install.
-
Sign in to GitHub: After installing, you’ll be prompted to sign in to your GitHub account. Follow the prompts to authorize Copilot.
-
Start Your Free Trial: If you haven't subscribed yet, you can start your free trial during the sign-in process.
Step 2: Writing Your First Code with Copilot
Now that you have everything set up, let’s start coding!
-
Create a New File: In VS Code, create a new file and save it with an appropriate extension (e.g.,
.js,.py,.html). -
Write a Comment: Start by writing a comment that describes what you want to accomplish. For example, if you’re building a simple to-do list, you might write:
// Function to add a new task to the to-do list -
Trigger Suggestions: After writing the comment, hit
Enter. Copilot will automatically suggest code that matches your comment. If you see a suggestion you like, simply hitTabto accept it. -
Iterate: Continue writing comments for other functions and let Copilot generate code snippets for you. You can refine the suggestions by adjusting your comments to be more specific.
Step 3: Testing Your Code
-
Run Your Code: Depending on your programming language, you may need to set up a local server or use a terminal to run your code. For example, if you're using Node.js, you can run your script with:
node yourfile.js -
Debugging with Copilot: If you run into issues, you can ask Copilot to help debug. For instance, if you encounter an error, write a comment like:
// Fix the error in the add task function -
Refine and Optimize: Use Copilot to suggest optimizations. Just write a comment like:
// Optimize this function to handle multiple tasks
Troubleshooting Common Issues
- Not Getting Suggestions: If Copilot isn’t suggesting code, ensure you’re in a supported file type and that you’re connected to the internet.
- Incorrect Suggestions: AI isn’t perfect. If you get a suggestion that doesn’t make sense, simply ignore it or refine your prompt.
- Performance Lag: Sometimes, Copilot can be slow. If you notice lag, try closing other applications or restarting VS Code.
What’s Next?
After you’ve coded a few functions and tested them, consider the following next steps:
- Build a Simple Project: Use Copilot to help you build a small project from start to finish.
- Explore Advanced Features: Look into Copilot Labs for experimental features that might help you code more efficiently.
- Join the Community: Engage with other GitHub Copilot users on forums or GitHub discussions to share tips and tricks.
Conclusion: Start Here
Using GitHub Copilot can significantly speed up your coding process, especially if you're just starting out or looking to build side projects quickly. In about two hours, you can set it up, write some code, and get a feel for how it operates. Remember, while Copilot is powerful, it’s not a replacement for understanding the basics of coding.
With a little bit of practice, you’ll find yourself shipping products faster than ever. So why wait? Get started with GitHub Copilot today!
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.