Ai Coding Tools

How to Use GitHub Copilot to Write Code in 2 Hours

By BTW Team4 min read

Comparing tools? See the AI tools tested on the show.

In short

A step-by-step tutorial on how to effectively utilize GitHub Copilot to write your first lines of code within just 2 hours. Perfect for beginners eager to enhance their coding speed and accuracy.

If you're a solo founder or indie hacker, you know the struggle of writing code efficiently. You might have dabbled in coding but find it time-consuming or frustrating. Enter GitHub Copilot, an AI-powered coding assistant that can help you write code faster and smarter. In this guide, I'll show you how to set it up and use it effectively in just two hours—perfect for beginners and busy builders like you.

Prerequisites: What You Need to Get Started

Before diving in, make sure you have the following:

  • GitHub Account: Sign up for free if you haven't already.
  • Visual Studio Code: Download and install VS Code, as GitHub Copilot integrates seamlessly with it.
  • GitHub Copilot Subscription: As of July 2026, GitHub Copilot costs $10/month. There's a free trial available, so you can test it out before committing.
  • Basic Coding Knowledge: Familiarity with any programming language (like JavaScript or Python) will help, but you don't need to be an expert.

Step 1: Setting Up GitHub Copilot

  1. Install the GitHub Copilot Extension:

    • Open VS Code.
    • Go to Extensions (Ctrl+Shift+X).
    • Search for "GitHub Copilot" and click "Install."
  2. Sign In to GitHub:

    • Once installed, you'll be prompted to sign in to your GitHub account. Follow the on-screen instructions to authenticate.
  3. Activate Your Subscription:

    • If you haven’t activated your subscription yet, do it now. You can use the free trial for the first month.

Expected Output: You should see a success message confirming that GitHub Copilot is ready to use.

Step 2: Writing Code with GitHub Copilot

Now that you have Copilot set up, let's start coding!

  1. Create a New File:

    • Open a new file in VS Code and set the language (e.g., JavaScript).
  2. Start Typing Comments:

    • Begin by typing a comment that describes the function you want to create. For example:
      // Function to add two numbers
      
  3. Let Copilot Suggest Code:

    • After typing the comment, pause for a moment. Copilot will suggest code snippets. You can accept the suggestion by hitting the "Tab" key.
  4. Iterate and Refine:

    • If the first suggestion isn’t what you need, simply continue typing more details or ask for a different function. For example:
      // Function to add two numbers and return the result
      
  5. Test Your Code:

    • Run your code to ensure it works as expected. Copilot can also help you write test cases if you ask for them.

Expected Output: You should have a working function based on your comments, ready to test.

Step 3: Troubleshooting Common Issues

While using Copilot, you might encounter a few hiccups. Here’s how to handle them:

  • Unrelated Suggestions: If Copilot gives you irrelevant suggestions, try being more specific in your comments. For example, instead of "function to sort an array," use "function to sort an array of integers in ascending order."

  • Syntax Errors: Always double-check the generated code for syntax errors, as Copilot may not always get it right.

  • Limited Context: Copilot relies on the context you provide. If you're working on a complex project, make sure to give it enough context through comments.

What’s Next? Progression After Two Hours

After you've gotten the hang of using GitHub Copilot, consider the following steps:

  • Explore More Features: Copilot can help with more than just functions. Try writing classes, handling asynchronous code, or even generating documentation.

  • Integrate with Other Tools: Look into integrating Copilot with tools like GitHub Actions or CI/CD pipelines to streamline your workflow.

  • Join the Community: Engage with other developers using Copilot. You'll find tips and tricks that can enhance your coding experience.

Conclusion: Start Here

If you're looking to speed up your coding process and reduce frustration, GitHub Copilot is a solid investment. In just two hours, you can set it up and start writing code more efficiently. While it’s not perfect, it significantly reduces the learning curve and helps you focus on building your projects.

What We Actually Use

In our stack, we rely heavily on GitHub Copilot for rapid prototyping and code generation. We find it particularly useful during brainstorming sessions where we need to generate multiple ideas quickly.

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools
Ai Coding Tools

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them)

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them) In the everevolving landscape of AI coding tools, it's easy to get swept up in the hype. As indie hackers and s

Nov 30, 20263 min read
Ai Coding Tools

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026 In 2026, the landscape for indie hackers and solo founders has evolved significantly, especially with the advent

Nov 26, 20264 min read
Ai Coding Tools

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026 If you’re a developer stuck maintaining legacy code, you know the frustration. It’s like navigating a maze blindfolde

Nov 23, 20264 min read
Ai Coding Tools

10 AI Coding Tools That Will Save You Hours of Debugging in 2026

10 AI Coding Tools That Will Save You Hours of Debugging in 2026 Debugging can feel like a neverending cycle of frustration. Whether you're a solo founder or an indie hacker, spend

Nov 18, 20265 min read
Ai Coding Tools

10 Common Mistakes When Using AI Coding Tools for MVP Development

10 Common Mistakes When Using AI Coding Tools for MVP Development As a founder in 2026, you’re likely aware that AI coding tools can significantly speed up the MVP development proc

Nov 16, 20264 min read
Ai Coding Tools

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026 As a beginner developer, you’ve probably come across a ton of buzz surrounding AI coding tools. But with all the hyp

Nov 12, 20263 min read