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.

Facebook Comments
Samikshya Gautam

Subscribe to Samikshya's Blog

Join my mailing list to receive the latest updates and notification.

You have successfully subscribed. Check your mail!