Setting Up GitHub
Overview
In the previous lesson, you set up Google Colab and learned how to create, run, and save notebooks. Now you need a place to store and share your work outside of Google Drive — somewhere that tracks changes over time, lets you collaborate with others, and serves as a portfolio of your projects. That place is GitHub. In this lesson, you'll create a GitHub account, understand the basics of Git version control, and learn how to save your Colab notebooks directly to a GitHub repository.
Learning Objectives
By the end of this lesson, you will have learned how to:
- Initialize a GitHub repository and understand basic Git commands (clone, commit, push).
- Manage code versions and collaborate via pull requests. Save notebooks to GitHub.
Key Terms
Git: A distributed version control system that tracks changes to files over time. Git is the underlying technology; GitHub is a website that hosts Git repositories.
GitHub: A cloud platform for hosting Git repositories, sharing code, and collaborating on projects. The industry standard for open-source and professional software development.
Repository (repo): A directory tracked by Git. Contains your files and the complete history of every change made to them.
Commit: A saved snapshot of your repository at a specific point in time. Every commit has a message describing what changed.
Branch: A parallel version of a repository. The default branch is called main. Branches let you develop new features without affecting the stable version.
Clone: Copying a remote repository (from GitHub) to your local machine or Colab session.
Push: Sending your local commits to the remote repository on GitHub.
Pull: Fetching and merging changes from the remote repository into your local copy.
Pull request (PR): A GitHub feature for proposing changes. You push changes to a branch, open a PR, and collaborators review before merging into main.
README: A markdown file (README.md) at the root of a repository that describes the project. GitHub displays it automatically on the repository's homepage.
Introduction
Every notebook you build in this curriculum should be saved to GitHub. This gives you:
- Backup — your work is never lost if your Colab session disconnects
- Version history — you can see exactly what changed and when
- Portfolio — recruiters and collaborators can see your projects
- Collaboration — teammates can contribute and review your work
Git can feel intimidating at first — but for data science notebooks, you only need about five commands, which you'll learn in this lesson.
Step 1: Create a GitHub Account
- Go to github.com
- Click Sign up and follow the prompts
- Choose a professional username — this becomes part of your public profile URL (e.g.,
github.com/yourusername) - Verify your email address
Step 2: Create Your First Repository
A repository holds one project — typically one directory of related files.
- On GitHub, click the + icon (top right) → New repository
- Name it something descriptive, e.g.,
data-science-course - Set it to Public (so it's viewable as a portfolio)
- Check Add a README file
- Click Create repository

Your new repository is now live at https://github.com/yourusername/data-science-course.
Step 3: Save a Colab Notebook to GitHub
The easiest way to save a notebook from Colab to GitHub is through the built-in integration:
- Open your notebook in Colab
- Go to File → Save a copy in GitHub

- Authorize GitHub access if prompted (first time only)
- Select your repository and branch (use
main) - Add a commit message describing what you're saving (e.g.,
"Add Module 1 notebook") - Click OK
The notebook (.ipynb file) will appear in your repository. Refresh your GitHub repository page to see it.
Understanding Git: The Core Workflow
Behind the scenes, every save to GitHub involves the same three-step pattern:
1. Make changes to files
↓
2. git add — stage the changes you want to commit
↓
3. git commit — save a snapshot with a message
↓
4. git push — send commits to GitHub
You can also perform these steps directly in Colab using the terminal (via the shell ! prefix):
# In a Colab code cell — configure Git with your identity (first time only)
!git config --global user.email "you@example.com"
!git config --global user.name "Your Name"
# Clone your repository into the Colab session
!git clone https://github.com/yourname/data-science-curriculum.git
# Move into the repository directory
import os
os.chdir("data-science-curriculum")
# Copy your notebook into the repo folder, then stage, commit, and push
!git add my_notebook.ipynb
!git commit -m "Add Module 1 practice notebook"
!git push origin main
Note: Pushing via HTTPS will prompt for a username and password. Use a Personal Access Token (PAT) instead of your password — generate one at
GitHub → Settings → Developer Settings → Personal Access Tokens.
Essential Git Commands
| Command | What it does |
|---|---|
git clone <url> | Copy a remote repository to your machine or session |
git status | Show which files have changed or are staged |
git add <file> | Stage a file for the next commit |
git add . | Stage all changed files |
git commit -m "message" | Save a snapshot with a descriptive message |
git push origin main | Send commits to the main branch on GitHub |
git pull | Fetch and merge remote changes into your local copy |
git log | Show the commit history |
Writing Good Commit Messages
A commit message should explain what changed and why — not just "update" or "fix stuff":
| Bad | Good |
|---|---|
update | Add EDA notebook for Module 5 |
fix | Fix median imputation bug in age column |
stuff | Complete feature engineering for house rental case study |
A readable commit history is a professional habit. Treat it as a log that a teammate (or future you) can follow.
Viewing Your Repository
Your repository at github.com/yourname/data-science-curriculum shows:
- Files — all files in the repository with their last commit message
- README — rendered automatically from
README.md - Commits — full history of every change
- Code — browse any file directly in the browser
GitHub renders .ipynb notebooks — viewers can see your code and outputs without running them. This makes your repository a living, readable portfolio.
Branching and Pull Requests (Brief Overview)
For solo work, committing directly to main is fine. For collaborative projects, the standard workflow is:
- Create a new branch:
git checkout -b feature/eda-analysis - Make changes and commit on that branch
- Push the branch:
git push origin feature/eda-analysis - Open a Pull Request on GitHub — a request to merge your branch into
main - A collaborator reviews the changes and approves or requests edits
- Merge the PR — your changes join
main
You'll use pull requests whenever you submit work for instructor review in this curriculum.
Submitting Assignments
For each module assessment, you'll:
- Complete the Colab notebook
- Save it to your GitHub repository using File → Save a copy in GitHub
- Copy the URL of the notebook file on GitHub (e.g.,
https://github.com/yourusername/repo/blob/main/module1.ipynb) - Submit the URL
The URL lets graders view your notebook, outputs, and commit history without needing to run any code.
Conclusion
GitHub is where your data science work lives. Every notebook you complete in this curriculum should be committed there — both as a backup and as a growing portfolio. You now know how to create a repository, save notebooks from Colab, understand the add-commit-push workflow, and write meaningful commit messages. In the next lesson, you'll learn how to use AI coding assistants effectively as a pair programming partner — one of the most important productivity tools in modern data science.