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 usingcd commands, use these shortcuts:
Clone a project
- HTTPS (Recommended)
- SSH
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.Creating your own repository
Let’s put yourpython-for-ai project on GitHub so it’s backed up online.
Step 0: Create a .gitignore file first
Create a file called.gitignore in your project’s root folder and add this content:
Step 1: Create the repository on GitHub
- Go to github.com and click the green New button (or click + → New repository)
- 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
- Repository name:
- Do not add a README, .gitignore, or license at this step
- 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:- HTTPS (Recommended)
- SSH
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:Common tasks
Clone a repository using VS Code's UI
Clone a repository using VS Code's UI
- Press
Ctrl/Cmd + Shift + Pto open the Command Palette - Type Git: Clone and select it
- Paste the repository URL
- Choose a folder to save the project
- VS Code opens the cloned project automatically
Private vs public repositories
Private vs public repositories
- 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.
What goes in .gitignore?
What goes in .gitignore?
.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:- Clone any Python project on GitHub that interests you
- Create a new repository for one of your practice scripts
- 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