Cloning a repository
Cloning means downloading a complete project — including all its history — from GitHub to your computer.- HTTPS (Recommended)
- SSH
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.Creating your own repository
Let’s publish yourpython-for-ai project to GitHub so it’s backed up and shareable.
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
- HTTPS (Recommended)
- SSH
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:Common tasks
Clone with the VS Code UI
Clone with the VS Code UI
- Press
Ctrl / Cmd + Shift + P - Type Git: Clone
- Paste the repository URL
- Choose where to save it
- VS Code opens the project automatically
Private vs public repositories
Private vs public repositories
- Private — Only you (and anyone you invite) can see it. Good for learning projects.
- Public — Anyone can see it. Good for portfolio work.
What belongs in .gitignore
What belongs in .gitignore
Practice exercise
Try this before moving on:- Clone any Python project on GitHub that interests you
- Create a new repository for one of your practice scripts
- 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