A Beginner’s Guide to Git and GitHub: From Installation to Your First Push
Source: Dev.to

Starting my journey in Data Science, Analysis, and AI at LUXDevHQ felt like learning a new language while trying to build a house. One of the most important tools I’ve discovered along the way is Version Control.
In this guide, I’ll walk you through:
- Setting up Git Bash
- Connecting Git to GitHub
- Mastering essential push and pull commands
What Is Git and Why Does It Matter?
Git is a Version Control System (VCS). Think of it as a save‑point system for your code.
Why is Git important?
- ⏪ Time Travel – If you break your code, you can roll back to a version that worked.
- 🤝 Collaboration – Multiple people can work on the same project without overwriting each other’s work.
- 🧪 Experimentation – You can create branches to try new features without affecting the main project.
Setting Up Your Environment
Step A: Install Git Bash
- Go to Git and download Git for your OS (Windows, macOS, or Linux).
- Run the installer.
💡 Pro tip: You can keep the default settings for most options.
- After installation, open Git Bash (it looks like a terminal window).
Step B: Configure Your Identity
Configure your global Git settings so GitHub knows who is uploading code:
git config --global user.name "Your Name"
git config --global user.email your-email@example.com
Secure Your Connection: Setting Up SSH Keys
Using SSH is the professional standard. It’s more secure and saves you from typing your password every time you push code.
Step 1: Generate Your SSH Key
Open Git Bash and run (replace with your GitHub email):
ssh-keygen -t ed25519 -C your_email@example.com
- File location: Press Enter to accept the default (
~/.ssh/id_ed25519). - Passphrase: You can leave this empty for convenience (or set one for extra security).
Step 2: Add Key to the SSH Agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Step 3: Add the Public Key to GitHub
Copy the public key to your clipboard:
cat ~/.ssh/id_ed25519.pub
Then:
- Go to GitHub → Settings → SSH and GPG keys → New SSH key.
- Give it a name (e.g., “My Learning Laptop”) and paste the key into the Key box.
Step 4: Test the Connection
ssh -T git@github.com
If you see Hi <username>! You've successfully authenticated, you’re ready!
Navigating and Creating Your Project
Using Git Bash to navigate is faster than using a mouse. Run these commands to create your first repository:
pwd # Print Working Directory
cd Desktop # Go to Desktop
mkdir my-first-repo # Create folder
cd my-first-repo # Enter folder
Tracking Changes (The Core Workflow)
Inside your project folder, run:
git init # Start tracking the folder
git status # See what Git notices
git add . # Stage all changes
git commit -m "My first commit" # Create a save point
Pushing Code to GitHub
Step A: Create the Repository on GitHub.com
- Log into GitHub, click the + icon → New repository.
- Name it (e.g.,
my-first-project) and keep it Public. - Leave “Add a README” unchecked to avoid conflicts.
- Click Create repository.
Step B: Connect and Push
On the GitHub setup page, copy the SSH URL (it looks like git@github.com:your-username/repo-name.git) and run:
git remote add origin git@github.com:your-username/repo-name.git
git push -u origin main
Pulling Code from GitHub
If you work on a different computer, download the latest updates with:
git pull origin main
Resources to Keep Learning
Conclusion
Congratulations! You’ve just set up a professional development workflow. Git can be tricky at first, but with practice it becomes second nature. If you run into any issues, feel free to comment and help each other out!