Day 5: Sharing With the World
Time commitment: â 20 minutes (+ video)
Welcome to Day 5!
Today you'll learn how developers save, track, and share their work using Git and GitHub.
By the end of this lesson, your AI chat interface will be backed up onlineâand you'll understand the daily workflow every professional engineer uses.
Before We Start
You should have your AI chat interface project cleaned up and working from Day 4. It should be in its own folder (like ai-chat-interface or ai-text-generator) with just the chat functionalityâno extra HTML/CSS from earlier lessons.
If you haven't done this yet, go back to Day 4 and complete the challenge to create a standalone chat interface.
Video Context
In the video, you'll see me using iTerm2 on a Mac, and my Git/GitHub are already configured. That means I won't see first-time authentication prompts, but you mightâand that's completely normal.
đ„ Watch: Git & GitHub â The Daily Workflow
Follow along as we initialize Git, create a repo on GitHub, protect your API key, and push your project.
Why Git and GitHub Matter
- Collaboration & Team Work â Multiple people can work without overwriting each other.
- Version Control â Every change is a checkpoint; you can always roll back.
- Portfolio & Proof â Public record of projects and growth.
- Industry Standard â Used everywhere, from Big Tech to startups.
About the green squares: Nice to have, not everythingâmany senior devs have empty graphs due to private work.
What Are Git and GitHub?
| Tool | Purpose | Analogy |
|---|---|---|
| Git | Tracks changes to code locally on your computer | âTrack Changesâ for programmers + time machine |
| GitHub | Cloud hosting for Git repositories | Google Drive + social network for developers |
Git lives on your computer. GitHub lives on the internet.
Step 1: Install Git (If You Haven't Already)
Follow the installation guide at git-scm.com.
git
git --version
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Step 2: Create a GitHub Account
Go to github.com â Sign Up â Verify your email. Use a professional username.
Step 3: Create a New GitHub Repository
- GitHub â + (top right) â New repository
- Name it
ai-text-generator(or your folder name) - Keep it Public
- Do NOT initialize with README, .gitignore, or license
- Click Create repository
Step 4: Open Your Project in VS Code Terminal
- Open your project folder in VS Code
- Terminal â New Terminal
- Ensure youâre in the correct directory
Helpful commands:
pwdâ where am I?lsâ list filescd folder-nameâ go into a foldercd ..â go up one directory
Windows: Install Git Bash to use the same commands.
Step 5: Protect Your API Key
Before pushing to GitHub, keep your Gemini API key out of the repo.
Create config.js
window.API_KEY = 'YOUR_ACTUAL_GEMINI_API_KEY_HERE';
Update script.js
Use the key from config.js without hardcoding it again:
const API_KEY = window.API_KEY; // read from config.js
Load order in index.html
<script src="config.js"></script>
<script src="script.js"></script>
script.js needs the key available, so config.js must load first.Step 6: Create .gitignore
# Keep API keys private
config.js
# macOS system files
.DS_Store
Step 7: Initialize Git and Make Your First Commit
git init
git status
git add .
git commit -m "Initial commit: AI text generator"
Step 8: Connect to GitHub and Push
git remote add origin https://github.com/YOUR-USERNAME/ai-text-generator.git
git push -u origin main
Auth: If prompted, type your username and password (or a Personal Access Token). Your typing wonât appearâthatâs normal.
Step 9: Verify It Worked
Refresh your repo on GitHub. You should see:
index.htmlstyle.cssscript.js.gitignore
And not config.js. Perfect.
Step 10: Make a Change and Push Again
Make a change
// Updated: improved error handling
Check diff, commit, push
git status
git diff # press Q to exit
git add .
git commit -m "Remove comments and clean up code"
git push
Understanding Git Commands
| Command | What It Does |
|---|---|
git status |
Shows what files changed |
git diff |
Shows exact changes |
git add . |
Stages all changes |
git commit -m "msg" |
Creates a checkpoint |
git push |
Uploads commits to GitHub |
git log |
Shows commit history |
Viewing Your Commit History
On GitHub, click âX commitsâ to see who changed what and when.
Common First-Time Issues
| Issue | Solution |
|---|---|
| Password prompt shows nothing | Normalâtype and press Enter |
| Authentication failed | Use a Personal Access Token |
| Permission denied (publickey) | Use HTTPS or set up SSH keys |
git: command not found |
Install Git or fix PATH |
| Line-ending warnings | Safe to ignore |
.DS_Store in repo |
Add to .gitignore |
Why Not GitHub Pages (Yet)?
Because youâre using an API key. On a public site, anyone can view source/console and steal it. Later youâll learn to deploy with a backend and environment variables.
Helpful Resources
Official Docs
Videos
- Git & GitHub Crash Course (freeCodeCamp)
- Git Tutorial (Mosh)
- Git in 100 Seconds (Fireship)
- Git in 15 Minutes (Colt Steele)
- GitHub Beginnerâs Guide (Kevin Stratvert)
- Git & GitHub (Amigoscode)
- Personal Access Token Setup
Key Takeaways
git initstarts trackinggit add .stages changesgit commit -mmakes a checkpointgit pushpublishes to GitHub- Use
.gitignoreto protect secrets (like API keys)
Your Challenge
- Make a small change
- Run the workflow:
git status
git add .
git commit -m "Your message here"
git push
- Verify the update on GitHub
- Share your repository link
What Youâve Accomplished
- â Built a website with HTML and CSS
- â Added interactivity with JavaScript
- â Connected to a real AI API
- â Created a working chat interface
- â Stored your code on GitHub using Git
Youâre working like a real developer. Keep going.