How to Use GitHub Copilot to Write Your First 100 Lines of Code in 2 Hours
How to Use GitHub Copilot to Write Your First 100 Lines of Code in 2 Hours
If you're just starting out on your coding journey, the thought of writing your first lines of code can be intimidating. I remember my first attempt—sitting there, staring at a blank screen, wondering where to begin. Fast forward to 2026, and tools like GitHub Copilot have changed the game for beginners. With its AI-powered suggestions, you can write your first 100 lines of code in just about two hours. Let’s break down how to effectively use GitHub Copilot to get you coding quickly and efficiently.
Prerequisites: What You Need Before Getting Started
Before you dive in, you’ll need a few things:
- GitHub Account: Sign up for free at GitHub.
- Visual Studio Code: Download and install this code editor, which is free and widely used.
- GitHub Copilot Subscription: It costs $10/month after a 30-day free trial. This is necessary to access Copilot's features.
- Basic Understanding of Programming: Familiarity with concepts like variables and functions will help, but you can still follow along as a complete beginner.
Step 1: Setting Up Your Environment
-
Install Visual Studio Code: Go to the Visual Studio Code website and download the appropriate version for your operating system.
-
Install the GitHub Copilot Extension: Open Visual Studio Code, navigate to the Extensions view (Ctrl+Shift+X), and search for "GitHub Copilot." Click "Install."
-
Log in to GitHub: Once the extension is installed, you’ll need to log in to your GitHub account to activate Copilot.
Expected Output: After setup, you should see the Copilot icon in the Visual Studio Code sidebar.
Step 2: Writing Your First Lines of Code
-
Create a New File: Start by creating a new file with a
.jsextension for JavaScript (or any language you prefer). -
Start Coding: Type a simple comment or a function name. For example, you might write
// Function to calculate the sum of two numbersand hit enter. Copilot will suggest code for you. -
Accept Suggestions: If the suggestion looks good, press Tab to accept it. If not, you can keep typing or hit Ctrl+Space to see alternative suggestions.
-
Iterate: Continue adding comments or function names to guide Copilot. In about 30 minutes, you should have your first 50 lines of code.
Expected Output: You should see a completed function based on your comments.
Step 3: Testing Your Code
-
Run Your Code: Use the built-in terminal in Visual Studio Code to run your code. If you’re coding in JavaScript, you might use Node.js for execution.
-
Debugging: If you encounter errors, read the error messages carefully. Copilot can help suggest fixes, but you might need to do a bit of research to understand the error.
Expected Output: Successfully running your code with no errors.
Troubleshooting Common Issues
- Copilot Not Suggesting Code: Ensure you are logged in and that your file type is supported.
- Errors in Code: Don't hesitate to look up error messages. Sometimes Copilot’s suggestions need tweaking.
- No Suggestions for Complex Logic: If Copilot struggles, break down your logic into smaller parts.
What’s Next: Building Upon Your Foundation
Once you’ve written your first 100 lines of code, consider the following next steps:
- Explore New Languages: Try Python or Ruby. The process is similar.
- Build a Simple Project: Create a small app or game to solidify what you’ve learned.
- Join Coding Communities: Engage with fellow beginners on platforms like GitHub or Discord for support and collaboration.
Conclusion: Start Here
Getting started with coding in 2026 has never been easier, especially with tools like GitHub Copilot at your disposal. By following these steps, you can confidently write your first 100 lines of code in just two hours. If you find yourself stuck, remember that coding is a journey—embrace the learning process and keep experimenting!
What We Actually Use
In our experience, GitHub Copilot is a fantastic tool for beginners, but it's not infallible. We use it alongside traditional learning resources like Codecademy and freeCodeCamp to fill in the gaps. While Copilot can suggest code, understanding the underlying concepts is crucial for long-term success.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.