Ai Coding Tools

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

By BTW Team4 min read

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

Getting started with coding can feel like trying to learn a whole new language—overwhelming and intimidating. But what if I told you that you could write your first lines of code in just two hours with the help of GitHub Copilot? This AI-powered coding assistant can help you overcome the initial hurdles of programming by providing suggestions and even generating code snippets for you.

In this guide, I’ll walk you through how to effectively use GitHub Copilot, along with some practical tips and tools to make your coding journey smoother.

Prerequisites: What You Need Before You Start

Before diving into GitHub Copilot, make sure you have the following:

  1. GitHub Account: Sign up for a free account if you don’t have one.
  2. Visual Studio Code (VS Code): Download and install VS Code, which is free and widely used.
  3. GitHub Copilot Subscription: GitHub Copilot costs $10/month after a 60-day free trial. Make sure to activate it in your VS Code.

Step 1: Install GitHub Copilot in VS Code

  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 "Install."
  4. Once installed, you’ll need to log in with your GitHub account and authorize the extension.

Expected Output: You should see GitHub Copilot activated in the bottom right corner of your VS Code window.

Step 2: Create a New Project

  1. Open a new folder in VS Code.
  2. Create a new file with a .js or .py extension for JavaScript or Python coding respectively.

Expected Output: You’ll have a new file where you can start coding.

Step 3: Start Coding with GitHub Copilot

  1. Begin typing a comment about what you want to do. For example, type // Function to add two numbers.
  2. Press Enter, and GitHub Copilot will suggest a code snippet.
  3. Accept the suggestion by pressing Tab or continue typing to refine it.

Example:

// Function to add two numbers
function add(a, b) {
    return a + b;
}

Expected Output: You should see the function code generated automatically.

Step 4: Testing Your Code

  1. To test your code, you can run it directly in an integrated terminal or use an online compiler.
  2. Make sure to validate that the output is as expected.

Expected Output: You should see the correct result when you run your code.

Troubleshooting: What Could Go Wrong

  • Copilot Not Suggesting Code: Ensure that you’re connected to the internet and logged into your GitHub account.
  • Incorrect Suggestions: Sometimes Copilot may suggest code that isn’t relevant. Don’t hesitate to modify the suggestions or ask for a different one.

What’s Next?

After you’ve written your first lines of code, consider exploring more complex projects. You can also:

  • Learn about Git for version control.
  • Explore other AI coding tools like Tabnine, Replit, and Codeium for different functionalities.
  • Join coding communities to get feedback and support.

Tool Comparison: GitHub Copilot vs. Other AI Coding Tools

| Tool | Pricing | Best For | Limitations | Our Verdict | |----------------|-------------------------|------------------------|-------------------------------------|----------------------------------| | GitHub Copilot | $10/mo (60-day free) | Beginners & pros | Limited languages & contexts | Great for quick suggestions | | Tabnine | Free tier + $12/mo pro | JavaScript & Python | Less context-aware than Copilot | Use if you want more control | | Codeium | Free | General coding | Less integrated with VS Code | Good for budget-conscious devs | | Replit | Free tier + $7/mo pro | Collaborative coding | Not as powerful as Copilot | Great for team projects | | Sourcery | Free tier + $12/mo pro | Python code reviews | Limited to Python | Use if you’re focused on Python |

Conclusion: Start Here

If you’re looking to dive into coding, GitHub Copilot is a solid starting point. It can help you write your first lines of code quickly while providing useful suggestions. Just remember, it’s a tool to aid you, not a replacement for learning the fundamentals.

So, set aside about two hours, follow these steps, and don’t hesitate to explore other resources to continue your coding journey.

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

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time As a developer, whether you're just starting out or have years of experience, debugging can feel like a neverend

Oct 16, 20265 min read
Ai Coding Tools

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow As developers, we’re always on the lookout for ways to streamline our workflow and boost productivity. Enter

Oct 14, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools That Could Hurt Your Development Process

5 Myths About AI Coding Tools That Could Hurt Your Development Process As a solo founder or indie hacker, you might be lured by the promises of AI coding tools that claim to simpli

Oct 13, 20264 min read
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read