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

●1 ●5
calendar_today ago • schedule3 min read
— Originally published at 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

1. 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.

2. Setting Up Your Environment

Step A: Install Git Bash

  1. Go to Git and download Git for your OS (I used Windows).
  2. Run the installer.

    💡 Pro tip: You can keep the default settings for most options.

  3. After installation, search for Git Bash in your applications. It looks like a terminal window.

Step B: Configure Your Identity

To let GitHub know who is uploading code, configure your global Git settings:

git config --global user.name "Your Name"
git config --global user.email *Emails are not allowed*

3. 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 enter (replace with your GitHub email):

ssh-keygen -t ed25519 -C *Emails are not allowed*

•File Location: Press Enter to use the default location.
•Passphrase: As a beginner, I left this empty for convenience.

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

1.Copy the key:

cat ~/.ssh/id_ed25519.pub 

2.Go to GitHub: Settings → SSH and GPG keys → New SSH Key.

3.Give it a name (e.g., "My Learning Laptop") and paste your key into the "Key" box.

Step 4: Test the Connection

Run:

ssh -T *Emails are not allowed*

Success Check! If you see "Hi [YourUsername]! You've successfully authenticated", you are ready!


4. Navigating and Creating Your Project

Learning to navigate via Git Bash makes you much faster than using a mouse! Use these commands to create your first repository:
•Check Location: pwd (Print Working Directory).
•Go to Desktop: cd Desktop
•Create Folder: mkdir my-first-repo
•Enter Folder: cd my-first-repo


5. Tracking Changes (The Core Workflow)

Before sending code to GitHub, Git needs to "track" it locally. Run these inside your project folder:
1.Initialize Git: git init (Starts tracking the folder).
2.Check Status: git status (See what files Git notices).
3.Add Files: git add . (Stages all changes to be saved).
4.Commit: git commit -m "My first commit" (Creates the "save point").


6. Pushing Code to GitHub

Pushing sends your local save points to the cloud.

Step A: Create the Repository on GitHub.com

1.Log into GitHub, click the + icon → New repository.
2.Name it (e.g., my-first-project) and keep it Public.
3.Important: Leave "Add a README" unchecked to avoid conflicts.
4.Click Create repository.

Step B: Connect and Push

On the GitHub setup page, click SSH and copy the URL. Then run these commands one by one:

git remote add origin *Emails are not allowed*:your-username/repo-name.git
git push -u origin main

7. Pulling Code from GitHub

If you work on a different computer, use Pull to download the latest updates from the cloud:

git pull origin main

📚 Resources to Keep Learning

•Official Git Documentation
•GitHub Skills: Interactive Courses
•Visualizing Git Commands (Game)

Conclusion: Congratulations! You've just set up a professional dev workflow. Git can be tricky at first, but keep practicing and it will become second nature. If you ran into any issues, drop a comment below and let's help each other out!

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

Tailwind CSS for Beginners: From Zero to Your First Component

muhammadfarhan.dev - Jul 21

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Local-First: The Browser as the Vault

Pocket Portfolio - Apr 20

Cisco's Amy Chang: A Model's "Passport" Doesn't Tell You Where It Actually Came From

Tom Smithverified - Aug 27
chevron_left
155 Points • 6 Badges
2Posts
0Comments
5Connections
Versatile ICT pro from Nairobi: Diving deeper into Python, SQL, data analytics, and software dev. W... Show more

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!