Ai Coding Tools

How to Use GitHub Copilot to Write Your First Lines of Code in 2 Hours

By BTW Team3 min read

How to Use GitHub Copilot to Write Your First Lines of Code in 2 Hours

If you're a beginner looking to dip your toes into coding, you might feel overwhelmed by the sheer volume of information and tools available. You want to code, but where do you start? Enter GitHub Copilot, an AI-powered coding assistant that can help you write your first lines of code in just a couple of hours. In this guide, I’ll walk you through how to leverage GitHub Copilot effectively to get you started.

What You Need to Get Started

Prerequisites

Before diving in, make sure you have:

  • A GitHub account (Free)
  • Visual Studio Code installed (Free)
  • GitHub Copilot subscription ($10/month or $100/year)
  • Basic understanding of programming concepts (variables, loops, etc.)

Time Estimate

You can finish this setup and initial coding in about 2 hours.

Setting Up GitHub Copilot

Step 1: Install Visual Studio Code

  1. Download Visual Studio Code from the official website.
  2. Follow the installation prompts for your operating system.

Step 2: Install GitHub Copilot

  1. Open Visual Studio Code.
  2. Navigate to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side.
  3. Search for "GitHub Copilot" and click on "Install".
  4. Sign in with your GitHub account when prompted.

Step 3: Configure Copilot

  1. Open any JavaScript or Python file (you can create a new one).
  2. Start typing a comment describing what you want to accomplish. For example, “Create a function to calculate the area of a rectangle.”
  3. Hit “Enter” and watch Copilot suggest code snippets.

Writing Your First Lines of Code

Step 4: Generate Basic Functions

  1. Example 1: Rectangle Area Calculation

    • Type: // Function to calculate area of rectangle
    • Copilot will suggest a function. Accept it by pressing “Tab”.
  2. Example 2: Simple Loop

    • Type: // Print numbers from 1 to 5
    • Accept the suggested loop.

Step 5: Test Your Code

  1. Run your code directly in Visual Studio Code using the built-in terminal.
  2. Check the outputs to ensure everything works as expected.

Troubleshooting Common Issues

What Could Go Wrong?

  • Copilot doesn’t suggest anything: Make sure you are typing comments clearly.
  • Code doesn’t work: Verify the syntax and logic. Copilot is helpful, but it can make mistakes.

Solutions

  • If you encounter errors, refer to documentation for the language you are coding in.
  • Use online forums or communities (like Stack Overflow) for additional support.

What's Next?

Once you've written your first lines of code, consider the following steps:

  1. Explore More Examples: Try writing different functions or algorithms.
  2. Learn About Version Control: Familiarize yourself with Git to manage your code.
  3. Join a Coding Community: Engage with others to improve your skills.

Conclusion

Getting started with coding doesn’t have to be daunting. With GitHub Copilot, you can write your first lines of code in just two hours. Just remember, while Copilot is a powerful tool, it’s not infallible. Use it as a guide, but always verify and understand the code it generates.

Start Here

If you’re ready to dive into coding with Copilot, follow these steps and see how it can accelerate your learning.

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

AI Coding Tools: Cursor vs Codeium - Which is Worth Your Time?

AI Coding Tools: Cursor vs Codeium Which is Worth Your Time? As a solo founder or indie hacker, you know the importance of coding tools that actually enhance your productivity. In

Apr 25, 20263 min read
Ai Coding Tools

AI Code Assistants: Cursor vs GitHub Copilot - Which Is Best in 2026?

AI Code Assistants: Cursor vs GitHub Copilot Which Is Best in 2026? As a solo founder or indie hacker, you know the struggle of writing code efficiently while juggling multiple pr

Apr 24, 20263 min read
Ai Coding Tools

Why Your AI Coding Tools Might Be Slowing You Down: 7 Myths to Dispel

Why Your AI Coding Tools Might Be Slowing You Down: 7 Myths to Dispel As a developer, you’ve probably heard the hype surrounding AI coding tools. They promise to make you faster, m

Apr 24, 20264 min read
Ai Coding Tools

How to Use AI Coding Tools to Build Your First Web App in 4 Weeks

How to Use AI Coding Tools to Build Your First Web App in 4 Weeks If you're an indie hacker or a solo founder, you probably know the struggle of wanting to build a web app but feel

Apr 24, 20264 min read
Ai Coding Tools

Supabase vs Firebase: Which AI-Driven Database Should You Use?

Supabase vs Firebase: Which AIDriven Database Should You Use? (2026) As a solo founder, choosing the right database can feel like a daunting task. With so many options available, i

Apr 24, 20263 min read
Ai Coding Tools

AI Coding Tools: Cursor vs GitHub Copilot for Solo Developers

AI Coding Tools: Cursor vs GitHub Copilot for Solo Developers As a solo developer, finding the right coding assistant can feel like searching for a needle in a haystack. With a gro

Apr 24, 20263 min read