If you’re new to Git and GitHub, welcome! Don’t worry, you don’t need to be a coding wizard. This guide will walk you through everything, step by step, from downloading the tools and creating your GitHub account to pushing your first project online, and understanding the basics of version control.
And yes…there will be frustration and mistakes, but don't be like me, a person who tried to understand Git when hungry.
Step 1: Understand the Goal
The goal of Git is simple:
- Track changes in your project on your computer
- Push these changes to GitHub so the world (or just your future self) can see them Think of Git as your personal diary for your project, but with a very strict editor
Step 2: Create a GitHub Account
Before you can push anything online, you need a GitHub account:
- Go to https://github.com
- Click Sign Up
- Fill in your username, email, and password
- Verify your email
Congratulations! You now have a GitHub account—the gateway to version control fame.
Step 3: Download Git and Git Bash
Next, download the tools you need to communicate with GitHub:
- Download Git: https://git-scm.com/downloads
- Install Git Bash (it usually comes with Git) Git Bash is your terminal and in simpler terms, the “control room”, where all the magic happens. Accept the defaults during installation.
Optional: You can also download GitHub Desktop (https://desktop.github.com) if you prefer a GUI version, but this guide focuses on Git Bash to understand the basics.
Step 4: Configure Git (Set Your Identity)
Git needs to know who you are, so it can attach your name and email to commits. In Git Bash, type:
git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"
Check whether the code has worked with:
git config --list
Think of this as signing your work. Without it, GitHub may show your commits as “unknown user.”
Step 5: Create a Project Folder
Your “project” is just a folder with at least one file. It can be as simple as a README.md.
- Open Documents (or anywhere safe).
- Create a folder called:
my-first-repo - Inside, create a file called README.md with some text:
My first GitHub project
Pro tip: Don’t try to be fancy. Keep it simple. One folder, one file, and you’re good to go
Step 6: Initialize Git in the Right Place
Here’s where I learned my first painful lesson. I accidentally ran the following in my home directory (C:\Users\YourName).:
git init
git add .
The result? My poor computer started complaining:
warning: could not open directory 'AppData/Local/...': Permission denied
fatal: adding files failed
What was happening? Git was trying to track my entire computer profile, including:
- AppData (system files)
- Windows temp files
- Eclipse configuration files
- SSH keys
- My soul And Windows was like: “Nope. Not today, buddy.”
Lesson learned: Never, ever run Git commands in your home folder. Or any system folder. Unless you want to face the wrath of permission-denied errors
Step 7: Open Git Bash in the Project Folder
Right-click inside my-first-repo → Open Git Bash here.
Check your location by the typing the following in Git Bash:
pwd
You should see:
/c/Users/YourName/Documents/my-first-repo
If you see /c/Users/YourName instead, STOP.Close Git Bash. Walk away. Grab a snack. You’ll thank me later. Then later come and initialize it in the correct place.
Step 8: Initialize Git
Inside your project folder:
git init
You should see:
Initialized empty Git repository
This creates a Git “tracking system” for your project.
Step 9: Add and Commit Your Files
Stage your files for tracking:
git add .
Ignore harmless warnings like:
LF will be replaced by CRLF
Commit your changes:
git commit -m "Initial commit"
Then check the status with:
git status
You should see:
nothing to commit, working tree clean
Think of commits as screenshots of your project. They let you go back in time if needed.
Step 10: Create a GitHub Repository
- Go to GitHub and create a new repository Name: my-first-repo Leave it empty (no README, no license)
- Copy the SSH link in the repository. It will be written as:
git@github.com:YourUsername/my-first-repo.git
Step 11: Connect Local Repository to GitHub
In Git Bash, run the following codes:
git remote add origin git@github.com:YourUsername/my-first-repo.git
git branch -M main
git push -u origin main
remote add origin → links your local project to GitHub
branch -M main → sets your main branch
push -u origin main → sends your files online
Refresh your GitHub repository, and there is your README.md! 🎉
Step 12: Pulling Code and Tracking Changes
Once your project grows, you’ll want to track changes and collaborate.
- To check the status of your folder:
git statusShows you what’s changed, what’s staged, and what’s untracked. - To pull updates from GitHub:
git pull origin mainThis gets changes others (or you from another computer) pushed online. - To stage and commit new changes:
git add . git commit -m "Updated file X" git pushThink of this as: Add → “I want to track this change” Commit → “Save this change snapshot” Push → “Send it to GitHub” - To view commit history
git logShows all previous snapshots with author, date, and message.
Step 13: Understand Version Control
Version control is like a time machine for your code.
- Every commit is a snapshot
- You can go back to previous snapshots if something breaks
- You can collaborate with others without overwriting each other’s work
- Branches let you work on new features separately, then merge when ready
In short: Git = your code diary + time machine + collaboration hub.
Step 14: Lessons Learnt.
- Location matters. Always run Git in your project folder.
- Ignore harmless warnings. Line-ending messages won’t hurt your files.
- Do not try to understand Git while hungry. Starvation leads to home folder disasters.
- Start small. One folder, one file, one commit.
- Have fun. Mistakes happen—laugh at them, learn, and push forward.
Git and GitHub can be intimidating at first, but step-by-step practice makes them approachable. Follow this guide, and soon you’ll feel like a Git superhero.
Commit responsibly, push wisely, and never Git hungry.
Top comments (0)