Skip to main content
There are two things you’ll do constantly with Git and GitHub: cloning projects that other people have built, and publishing your own. Cloning lets you grab any open-source AI tool or example and run it locally within seconds. Creating and pushing your own repository puts your work online, gives you a permanent backup, and builds the public portfolio that employers and collaborators will look at. Both operations are simpler than they sound.

Cloning a repository

Cloning means downloading a complete project — including all its history — from GitHub to your computer.
Skip the cd command entirely:
  • macOS — Right-click a folder in Finder → ServicesNew Terminal at Folder
  • Windows — Right-click a folder in Explorer → Open in Terminal (or Shift + right-click → Open PowerShell window here)
This opens the terminal already pointing at that folder.
If code . doesn’t work, you need to register the code command first:macOS: Open VS Code → press Cmd + Shift + P → type Shell Command: Install ‘code’ command in PATH → press Enter → restart your terminal.Windows: During VS Code installation, make sure Add to PATH is checked. If you missed it, reinstall VS Code and check that option, or right-click the project folder and choose Open with Code.
When cloning finishes, Git has downloaded all files and all history for that project. You can now run it, modify it, and learn from it freely.
Clone projects into a consistent location. A projects/ or repos/ folder inside your Documents directory keeps everything organized.

Creating your own repository

Let’s publish your python-for-ai project to GitHub so it’s backed up and shareable.
Before pushing to GitHub, create a .gitignore file. Without it, Git may try to upload your .venv folder, which can be multiple gigabytes — and the push will likely fail or take forever.

Step 1: Create a .gitignore file

Create a file named .gitignore at the root of your project with the following contents:

Step 2: Create the repository on GitHub

1

Open GitHub

Go to github.com and click the green New button (or +New repository).
2

Fill in the details

  • Repository name: python-for-ai
  • Description: Learning Python for AI development
  • Visibility: Private for now (you can change it later)
  • Do not add a README, .gitignore, or license — your local project already has its own files
3

Click Create repository

GitHub will show you the commands to connect your local project.

Step 3: Connect your local project and push

If prompted during the push, enter your GitHub username and your personal access token (not your password) as the credential.

The daily workflow

Once your project is on GitHub, your everyday routine is just three commands:
That covers 90% of everything you’ll do with Git.

Common tasks

  1. Press Ctrl / Cmd + Shift + P
  2. Type Git: Clone
  3. Paste the repository URL
  4. Choose where to save it
  5. VS Code opens the project automatically
  • Private — Only you (and anyone you invite) can see it. Good for learning projects.
  • Public — Anyone can see it. Good for portfolio work.
You can change a repository’s visibility at any time in its Settings tab on GitHub.

Practice exercise

Try this before moving on:
  1. Clone any Python project on GitHub that interests you
  2. Create a new repository for one of your practice scripts
  3. Make a small change, commit it, and push it

What’s next?

VS Code has a built-in visual interface for all of these Git operations. Let’s explore how to use it without typing a single terminal command.

Git in VS Code

Use Git with clicks instead of commands