For this module, close Copilot Chat. Everything here is done with buttons in VS Code, so you understand each step yourself.

8.1 Git in plain words

In a video game you save before the boss fight, and reload if you lose. Git does that for your project. It is a free tool on your laptop that keeps a history of your files.

Word Meaning
Repository (repo) Your project folder, plus its full history of save points
Stage Choosing which changed files go into the next save point
Commit One save point, with a short message saying what changed
GitHub A website that keeps an online copy of your repository
Push Uploading your commits from your laptop to GitHub
2026-10-28T18:30:47.029762 image/svg+xml Matplotlib v3.11.2, https://matplotlib.org/ From your folder to GitHub Your folder You (and Copilot) change files Staged You pick which changes to save Commit A save point with a message, on your laptop GitHub An online copy of your project stage commit push Everything left of GitHub happens on your laptop; only push sends your work online

Why it matters today: Streamlit Community Cloud takes your app from GitHub. No push, no live app.

8.2 Before your first save: check .gitignore and tell Git who you are

Do it

1

Open .gitignore in the Explorer. Check that it has a line that says .env. This tells Git never to save your key file. If the line is missing, add it and save the file.

2

Git writes your name on every commit, so it needs to know who you are. Open the terminal, stop the app with Ctrl+C, and run these two commands, one at a time, with your own name and the email of your GitHub account:

Terminal
git config --global user.name "Your Name"
Terminal
git config --global user.email "you@example.com"

Nothing appears when they succeed. You only do this once per laptop.

8.3 Create the repository

Do it click the Source Control icon in the left bar (Ctrl+Shift+G). Because your folder is not a repository yet, you see a button Initialize Repository. Click it.

What to look for

the panel now lists your files under Changes, each with a U (untracked: Git sees it, but has not saved it yet). .env is not in the list, and in the Explorer its name is greyed out. That is .gitignore at work. If .env is in the list, stop and tell a mentor.

8.4 Make your first commit

Do it

1
Stage

Hover over the Changes heading and click the + (Stage All Changes). The files move up to Staged Changes.

2
Write a message

In the box above, type a short note on what this save point holds, for example Investment calculator with live IDX prices.

3
Commit

Click Commit.

What to look for

the Changes list is empty: everything is saved in a commit on your laptop. Nothing is on the internet yet.

8.5 Push to GitHub

Do it

1

In Source Control, click Publish Branch.

2

If VS Code asks you to sign in to GitHub, allow it, and approve in the browser window that opens.

3

Choose Publish to GitHub public repository. Keep the suggested name or type your own, such as idx-stock-snapshot.

4

Wait for the message that the repository was published, and click Open on GitHub.

What to look for

on github.com you see your files, including app.py and requirements.txt, and your commit message. .env must not be there. If it is, tell a mentor: the key must be replaced, because deleting the file still leaves it in the history.

8.6 The everyday flow

From now on, every time your app works a little better:

Step In Source Control
1. Stage + next to Changes
2. Commit Type a message that says what changed, click Commit
3. Push Click Sync Changes to upload your new commits to GitHub

Save often: a commit is cheap, and it is your way back. If a later change breaks your app, right-click a file under Changes → Discard Changes, and that file goes back to your last commit. This cannot be undone.