Tutorial · Antigravity

Antigravity 102: Building Your Digital Safety Net with GitHub

Your AI agent writes code fast, which means you can lose code fast. It's time to build your digital safety net and master version control.

The video version · same thesis, looser edits

So, we’ve got Antigravity running. We built a landing page in 101. But here’s the thing: if your project folder looks like a disorganized mess of overwritten files and you are afraid to ask the AI for a new feature because it might break what currently works, you are operating without a net.

Today, we’re building your digital safety net. We are setting up GitHub.

Most people lose their work because they don’t have a “headquarters.” When you use AI to generate hundreds of lines of code in seconds, having a reliable save state is non-negotiable.

Setting Up Headquarters

First, you need a GitHub account. It’s the master log for your AI agents. Setting it up takes a minute.

Once you are in, go to your dashboard and create a new repository. We’ll name this one antigravity-102.

Crucial Step: Do not check the box to add a README file initially. Because we skip the README, GitHub provides us with the exact setup instructions we need to link our local machine to the cloud.

The Big Three Commands

If you learn nothing else about version control, you must master the “Big Three” Git commands. These are the commands you are going to use every single day.

1. The Gather Phase

git add .

This tells Git to gather up all the changed files in your folder. It stages them, preparing them for the save point.

2. The Save Point

git commit -m "your message here"

This is the most important command. It creates an immutable snapshot of your code at this exact moment. If the AI completely breaks your site in the next chat, you can always revert back to this commit. Make your messages descriptive (e.g., “base version” or “added hero section”).

3. Send to Headquarters

git push

Your commits are local until you push them. This command takes your snapshots and sends them to the cloud. Now your files are live in the cloud, safe from accidental deletions or local machine crashes.

The Authentication Loop (and Bypass)

When you make your first push, you will be prompted to authenticate. Antigravity handles this by popping up a link and asking you to enter an 8-character code in your browser.

Insight: Sometimes developers run into an authentication loop where the default browser fails to hand off the token properly. If you find yourself stuck in a loop, copying the auth link and opening it in a different browser (like Firefox) usually bypasses the block and successfully connects your local terminal to GitHub.

Managing AI Like a Pro

Once you’ve pushed your code, go to your GitHub repo and hit refresh. Your files are there.

You can now manually add a README.md file, run the Big Three again, and lock it in. You are no longer just prompting an AI; you are managing a software project with a proper safety net.

Now that our code is safe, we are ready to take it live. I’ll see you in 103.

More in Antigravity