Sitemap

GIT TUTORIAL

7 min readFeb 6, 2026

--

Press enter or click to view image in full size

Introduction

Git is a version control system that helps developers track changes in files and manage their projects efficiently.
GitHub is a cloud-based platform where Git repositories are stored and shared online.

For beginners, Git and GitHub may seem difficult at first because of commands and workflows.This tutorial is written specifically for beginners, explaining each step clearly using real commands and screenshots.

By the end of this tutorial, you will confidently understand how Git and GitHub work together.

What You Will Learn

In this tutorial, you will learn:

  • How to install Git
  • How to configure Git (username and email)
  • How Git tracks files
  • Basic Git commands (init, status, add, commit)
  • How to push files to GitHub
  • How to download files from GitHub
  • A basic idea of branches and merge

Install Git:

Go to the official Git website: https://git-scm.com

Press enter or click to view image in full size

The website will automatically detect your operating system

  • Click Download for Windows / macOS / Linux
  • Run the installer
  • As a beginner, keep all settings as default
  • Click Next until you reach Install
  • Click Finish after installation

Using the default settings is recommended for beginners and works perfectly for most users.

Press enter or click to view image in full size
Press enter or click to view image in full size

Run the installer:

click Next

Press enter or click to view image in full size

Select the installation location and click Next.

Press enter or click to view image in full size

If you want a desktop icon, check the box and click Next.

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

Select the default editor and click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Next

Press enter or click to view image in full size

click Install

Press enter or click to view image in full size

wait for 5 to 10 minutes to complete the installation process

Press enter or click to view image in full size

click Finish

Press enter or click to view image in full size

To verify that Git is installed correctly, open Command Prompt or Terminal and run:

git --version

If the Git version is displayed, the installation was successful. So far, the installation of Git is complete.

Steps to Create a GitHub Account

  1. Open a web browser and go to https://github.com
  2. Click the Sign up button
  3. Enter your email address
  4. Create a password
  5. Choose a unique username
  6. Verify your email using the code sent by GitHub
  7. Select the Free plan
  8. Complete the setup and log in to GitHub

Repository

A GitHub repository is an online folder where you store your project files.
You can upload files from your computer and download them anytime.

Steps to Create a GitHub Repository

  1. Click the + icon in the top-right corner of GitHub and select New repository.
  2. Enter a repository name for your project.
  3. Choose the visibility as Public.
  4. Turn ON the README option.
  5. Keep .gitignore as No .gitignore.
  6. Keep License as No license.
  7. Click the Create repository button.

Once completed, your GitHub repository will be created successfully.

Press enter or click to view image in full size

Next, create a folder on your computer and open the Command Prompt or Terminal inside that folder to use Git commands.

Press enter or click to view image in full size

Configure Git Username and Email

Git uses your name and email to identify who made the changes.
You must set this only once before using Git commands.This needs to be done at the beginning.

git config --global user.name "username"
git config --global user.email "email"
Press enter or click to view image in full size

To check the configuration, use the following command:

git config --list
Press enter or click to view image in full size

Git Init

git init is used to start Git in a folder.It turns a normal folder into a Git project so Git can track files and changes.

git init
Press enter or click to view image in full size

for explanation create one text file named commands and put commands inside and save the file.

Press enter or click to view image in full size

Git Status

git status is used to check the current state of files in a project.
It shows which files are new, modified, or ready to be committed.

git status
Press enter or click to view image in full size

stage

Staging means selecting files that are ready to be saved(committed).

Get VIDHYASRI.G’s stories in your inbox

Join Medium for free to get updates from this writer.

Command to stage all files:

git add .

Command to stage a specific file:

git add <file_name>

Git Commit

A commit saves your changes in Git.It keeps a record of what you changed and when you changed it.

git commit -m "First commit"
Press enter or click to view image in full size

copy the repository link from Github

The git remote add origin command links the local folder with the GitHub repository URL. The git remote -v command is used to check the connection and confirm that the repository is linked correctly for both push and fetch.

git remote add origin <repository link>
git remote -v
Press enter or click to view image in full size

Git Push Error

This error happens when the GitHub repository already has files that are not in the local project.

Fixing the Push Error

We use git pull to download the files from GitHub and merge them with the local project. After this, the push will work normally.

Press enter or click to view image in full size

After that, create a new file like the one shown below and save it.

Press enter or click to view image in full size

then again use the push command and run. now ,the problem will solve.

git push -u origin main
Press enter or click to view image in full size

after refreshing the Github you can see the file inside the repository.

Press enter or click to view image in full size

Git Clone

git clone downloads the project from GitHub to your computer. It creates a new folder with all the project files.

cd desktop
git clone <repository link>
Press enter or click to view image in full size

Git Pull

updates the project with the latest files from GitHub.If it says Already up to date, no new changes are available.

cd git
git pull origin main
Press enter or click to view image in full size

Unstage

Unstaging means removing files from the staging area before committing.

git reset <file_name>

GIT MERGE

Merging means combining changes from one branch into another branch.

git merge branch_name

CONCLUSION:

In this tutorial, we learned how to install Git and use its basic commands through the Command Prompt or Terminal. We explored important Git commands such as git init, git clone, git add (stage), git commit, git status, git push, git pull, git merge, and how to unstage files. By following the step-by-step process, we successfully created a Git repository, tracked changes, connected it to GitHub, and shared our code online. This tutorial helps beginners understand how Git works and how it is used in real projects.

--

--