Skip to main content
Two operations make up the majority of your day-to-day work with GitHub. The first is cloning — downloading an existing project from GitHub to your computer. The second is creating — initializing a new project locally and pushing it to GitHub for the first time. Let’s learn both.

Cloning a repository

Cloning means downloading a complete project from GitHub, including all its files and its entire history.

Open your terminal in the right folder

Before cloning, navigate to where you want the project to live. Instead of using cd commands, use these shortcuts:
Mac: Right-click any folder in Finder → Services → New Terminal at Folder (or hold Option and right-click → Open in Terminal)Windows: Right-click any folder in File Explorer → Open in Terminal (or Shift + right-click → Open PowerShell window here)This opens the terminal already inside that folder — no navigation needed!

Clone a project

If code . doesn’t work, you need to enable the shell command first:Mac: 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, check Add to PATH. If you missed it, reinstall VS Code and tick that option, or right-click the project folder and choose Open with Code.
After cloning, Git has downloaded all the project files and all of its commit history. You can now run, modify, and learn from the code immediately.
Keep all your cloned projects in a consistent location like ~/Documents/Projects or ~/repos. This makes them easy to find later.

Creating your own repository

Let’s put your python-for-ai project on GitHub so it’s backed up online.

Step 0: Create a .gitignore file first

Do this before anything else. Without a .gitignore, you might accidentally push your .venv folder to GitHub — it can be several gigabytes and will cause your push to fail or take an extremely long time.
Create a file called .gitignore in your project’s root folder and add this content:
Save the file. Git will now permanently ignore those files and folders.

Step 1: Create the repository on GitHub

  1. Go to github.com and click the green New button (or click +New repository)
  2. Fill in the details:
    • Repository name: python-for-ai
    • Description: Learning Python for AI development
    • Visibility: Choose Private for now — you can make it public later
  3. Do not add a README, .gitignore, or license at this step
  4. Click Create repository

Step 2: Connect your local project to GitHub

GitHub shows you the commands to use right after creating the repo. Run the appropriate set for your authentication method:
When you push for the first time using HTTPS, Git will ask for your GitHub username and your personal access token (not your GitHub password). VS Code will remember the token so you won’t be asked again.

The daily workflow

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

Common tasks

  1. Press Ctrl/Cmd + Shift + P to open the Command Palette
  2. Type Git: Clone and select it
  3. Paste the repository URL
  4. Choose a folder to save the project
  5. VS Code opens the cloned project automatically
  • Private — Only you (and anyone you invite) can see the repository. Good for learning projects and work-in-progress code.
  • Public — Anyone on the internet can see it. Good for portfolio projects and open-source work.
You can switch between private and public at any time in the repository’s Settings tab on GitHub.
The .venv/ folder contains all your installed packages and can be several gigabytes. The .env file contains your secret API keys. Neither should ever go to GitHub.

Practice exercise

Try all three of these to build your muscle memory:
  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 to that script, commit it, and push

What’s next?

VS Code has a built-in visual interface for all Git operations. Learn how to use it so you never have to leave your editor.

VS Code Git

Commit, push, and pull without touching the terminal