How To Use GitHub? Beginner’s Guide

How To Use GitHub? Beginner’s Guide

GitHub is a website where you can host your code, navigate through other’s codes and collaborate with other developers who are working on the same project. GitHub is also a distributed version control system, so if you face any major error, you can always go back to the point where it was working normally.

You can use GitHub in multiple ways.

  1. Using stand-alone GitHub Desktop application
  2. Using stand-alone GitHub website
  3. Using Git Command Line Interface and GitHub website (combined)


However, in this blog, you will learn about the no. 3 way, i.e. Using Git Command Line Interface and GitHub which is the most common way.


Step 1

Hit key[Windows] + [R] to the open Run dialog box and type cmd to open Command Prompt and type the command git


git in cmd before installing git


You will get the above result saying git’ is not recognized as an internal or external command, operable program or batch file.

It is because you have not installed Git. I did this deliberately to show you why you must download and install Git on your computer.


Step 2

Open a browser and search for ‘download git’. Click the one that says ‘Git – Downloads – Git SCM’.


search download git in google

You will be greeted with this page.


Download Git for windows

Under ‘Downloads’ section, select your operating system and download Git.


Step 3

Install Git.


installing git


Keep on clicking Next (leave everything default) and install.


installing git processing


Step 4

Once again, hit[Windows] + [R] to open Run dialog box, type cmd to open Command Prompt and type git. You will see a different result this time. It will look something like this.


git in cmd (after installing git)

Congratulations! You’ve successfully installed Git. Now you can use Git from the command line.

Now, next move on to the next part.


Step 5

Sign in to your GitHub account. If you haven’t signed up yet, go to and create an account.


signin to github


Step 6

After you have signed in or created your GitHub account, it’s time to link GitHub and Git.

The first thing you should after installing Git is set your username and email address, which you just set up in GitHub. This is an important step because every Git commit uses this information. Type the following in command prompt.

git config --global "Your GitHub Username"

git config --global “Your GitHub Email”


Step 7

Once you have configured the global username and email, go to GitHub and click on the + sign and click on ‘New Repository’.


create new repository


Step 8

Give your repository a name based on the project you are working. This is a test example, so I’ve set the name as ‘test_repository’. Also, write a description of it. Tick on ‘Initialize this repository with a README’. Then click on Create repository.


create new repository fill up info

Once the repository is created, you will see something like this.


repository created


Step 9

In the green box, you will see ‘Clone or download’. Click on it and you will see ‘Clone with HTTPS’ option with a link. Copy the given link.

The link will generally be in this order:


clone repository


Step 10

Open Command Prompt, and go to your desired drive. Create a folder called ‘GitHub Projects’ (optional).

Type the following code:

git clone [paste the code]

i.e. git clone and hit enter.

Once done, it will look something like this.


git clone


Now if you go to G:\GitHub Projects, you will see that a folder named ‘test_repository’ has been created. This is the same repository that we just created on GitHub website a few moments ago. What we did is, we simply copied the whole repository into our local machine. Whatever operations we perform now will only affect the local repository, not the one on the GitHub website. Only when we are ready to commit the changes, we shall push it.

Inside test_repository, you will see two things: .git folder and a file.



The .git folder contains all the information about your project. All git operations take place inside this folder. It also contains information about commits, remote repository address, etc. The good thing is we don’t have to take care of it. The file contains the repository’s name and the description you provided.


Step 11

Go inside the folder test_repository by typing cd test_repository. You work inside this folder. If you have your project folder somewhere else, copy it to this folder.

For this example, I am creating a new text file called ‘TestFile.txt’ inside test_repository folder. Write some text in the text file. I’ve written ‘This is just a text file.’


new text file

Step 12

In the command prompt, type git status

You will see the following on your screen.


git status


You will see that ‘TextFile.txt’ is red. This means, you have made changes in your repository but haven’t added it to the staging area yet. Staging is a step before the commit process in git. So, a commit in git is performed in two steps: staging and actual commit.

Now, type git add -- all

Then type git status


git add

You will see that the color of ‘TestFile.txt’ has changed into green. This means our files have been added to the staging area and are ready to commit.


Step 13

Type git commit -m “First Commit”

You should always write a comment like “First Commit” and describe in short what changes you made in that file. For example, if you’d added a new method named ‘getElements()’ in your code and added into the staging area, then your commit should be like

git commit -m “Add getElements() method”

You should practice this so that you and other developers working on the project know what changes you did in that commit.


git commit

Step 14

Once you’ve committed the final changes, it’s time to push your progress into GitHub repository.


git push -u origin master


git push


This command says to push the commit in the branch named master to the remote named origin. When this is executed, all the stuff that you last synchronized with the origin will be sent to the remote repository (i.e. repository in your GitHub) and others will be able to see them there.

Git and GitHub: What’s the difference?

Git and GitHub: What’s the difference?

There are people who think that Git and GitHub are the same thing and use the terms interchangeably. Some might even think Git is short for GitHub. It’s probably because of similarity in their names.


Git and GitHub are NOT similar.


In a simple term, Git is a tool and GitHub is a website (which is more like a community).

In a more technical term, Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency, while GitHub is a web-based Git repository hosting service, which offers all the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.

Git was created by Linus Torvalds, creator of Linux kernel.

Linus Torvald

Linus Torvalds was the designer of the open-source operating system Linux.


What is Git?

Git is a tool for version control which is primarily used by programmers. It runs with the command line on your local machine and allows you to keep track of your files and modifications made to those files in something called a ‘Repository’ or ‘Repo’. You can use it alone as well as with a team of people who are working on the same project. It’s useful in a team environment because everyone can work independently on those files, merge their changes together and there’s a permanent record of who made what change.


What is GitHub?

GitHub is a website that allows you to upload your Git repositories online.

Why would you want to host your files on GitHub?

Because it provides a backup of your files and gives you a visual interface for navigating your repositories. It provides other people a way to navigate your repositories. It also makes repo collaboration easy. GitHub is more common if you are using Git.


This example will make you clearer about what Git and GitHub are.

Consider you are a professional photographer and you use Adobe Photoshop to process your photos. You take the photos, edit them in Photoshop and when it’s ready, you upload them to your Facebook page.

In this context, Git is Adobe Photoshop and GitHub is Facebook.

What is Version Control System?

What is Version Control System?

You write your codes and compile it, it runs without any error. You add more codes or make changes to the existing codes, re-compile it and suddenly you are greeted with errors. Then the developer spends additional time searching for the mistake and correcting it. Every developer must have faced this situation. Things might be simpler if he is working on a smaller project, but such situation would be very challenging on a larger one. A single change or update to the existing code might cause an error and result in hours of hard work to fix it. This is where version control comes in.


What is Version Control?

Version Control is the management of changes designed to keep track of multiple versions of documents, computer programs, large websites, and other collections of information. It is also known as revision control or source control.

Version Control allows developers to save any or all changes that are made to their code. If they ever face the situation as mentioned above, they can simply turn their code back to the state when it was working, instead of be spending additional hours finding the mistake that broke the code. Developing software without using version control is risky because it is like not having backups.

Version Control System also allows multiple developers to work on a single project and save the changes to ensure that everyone can keep track of what they are working on. Version control also allows traceability, i.e. it allows the developers to trace every change made to the software over time.

Types of Version Control

There are three different types of Version Control Systems – Local, Centralized and Distributed.

  1. Local Version Control Systems

local version control system

Local version control system is a traditional approach, where you copy individual files from each computer into another directory. You save the changes in the form of patch sets, where the patch sets are dated and time-stamped. So, in case of the code breaks, the patch sets can be used to re-create what the file previously looked like.

  1. Centralized Version Control Systems

centralized local version control system

Centralized Version Control approach was created to solve the problem of collaboration. It has a single central copy of the project on a single server or a repository and if you commit any changes, the changes are directly made to that central copy. You take the files from that repository, work on it and put it back. In centralized version control, you never have a full copy of your project locally. Since this works like a central hub, so the major problem is that all the data would be lost in case the server fails.

CVS, Subversion, perforce are some popular centralized version control systems.

  1. Distributed Version Control Systems

distributed local version control system

Distributed Version Control Systems was created to solve the problem of centralized version control systems. In distributed version control, you don’t rely on a central server to store all the versions of a project’s file. Instead, you clone a copy of that repository locally so that you are not working on the original file. You work on the cloned copy of the project, and once all the changes are finalized, you can commit and make changes to that original file.

Another benefit of using distributed version control is it allows the developer to work on multiple projects at the same time.

Git is the most popular and widely used distributed version control system today.