ProgrammingBeginner

Git and GitHub for Beginners

Master version control with Git and learn to collaborate using GitHub.

Git and GitHub for Beginners
4clear steps

Before you begin

  • Basic command line knowledge

The walkthrough

Step by step.

01

Step 1 of 4

Installing and Configuring Git

Download Git from git-scm.com. After installation, configure your identity.

bash
# Configure your name and email
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

# Verify configuration
git config --list
Field note
  • Use your real name and GitHub email
  • This information appears in commits
02

Step 2 of 4

Creating Your First Repository

Initialize a Git repository in your project folder.

bash
# Navigate to your project folder
cd my-project

# Initialize Git repository
git init

# Check status
git status
Field note
  • Create .gitignore before first commit
  • Initialize Git at project start
03

Step 3 of 4

Making Commits

Commits are snapshots of your project at specific points in time.

bash
# Add files to staging area
git add filename.txt
git add .  # Add all files

# Create commit
git commit -m "Add initial files"

# View commit history
git log
git log --oneline  # Compact view
Field note
  • Write clear, descriptive commit messages
  • Commit frequently with logical changes
04

Step 4 of 4

Connecting to GitHub

Push your local repository to GitHub for backup and collaboration.

bash
# Add remote repository
git remote add origin https://github.com/username/repo.git

# Push to GitHub
git push -u origin main

# Pull latest changes
git pull origin main
Field note
  • Create repository on GitHub first
  • Use SSH keys for easier authentication

Guide complete

You’ve got the method. Now make it yours.