Ai Coding Tools

How to Use GitHub Copilot to Write Code in 2 Hours

By BTW Team4 min read

How to Use GitHub Copilot to Write Code in 2 Hours

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.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools and Why They Hold You Back

5 Common Misconceptions About AI Coding Tools and Why They Hold You Back As a solo founder or indie hacker, you might be considering leveraging AI coding tools to boost your produc

Oct 7, 20264 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools That Will Hurt Your Learning

5 Common Misconceptions About AI Coding Tools That Will Hurt Your Learning As a beginner in coding, diving into the world of AI coding tools can feel like stepping into a futuristi

Oct 6, 20263 min read
Ai Coding Tools

10 AI Coding Tools Beginners Overlook in 2026

10 AI Coding Tools Beginners Overlook in 2026 As a beginner in coding, diving into the vast ocean of AI tools can feel overwhelming. While flashy tools often grab the spotlight, ma

Oct 6, 20265 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools That Beginners Believe

5 Common Misconceptions About AI Coding Tools That Beginners Believe As a solo founder or indie hacker, diving into the world of AI coding tools can feel overwhelming, especially i

Oct 5, 20263 min read
Ai Coding Tools

5 Mistakes Every Beginner Makes When Using AI Coding Tools

5 Mistakes Every Beginner Makes When Using AI Coding Tools As a solo founder or indie hacker diving into the world of AI coding tools, it’s easy to get swept up in the excitement o

Oct 4, 20264 min read
Ai Coding Tools

10 Common Misconceptions About AI Coding Tools in 2026

10 Common Misconceptions About AI Coding Tools in 2026 As we dive into 2026, AI coding tools have become a staple in the developer toolkit. However, misconceptions still run rampan

Oct 4, 20264 min read