Creating a new GitHub Repository  

How to Create a new Repository on GitHub  

In the last tutorial, we have learned how to make use of Git clients if you are not comfortable using CLI. Now we will learn how to create a new repository on GitHub. Creating a new GitHub repository is very easy and can be learned easily.

Now in this tutorial, we will guide you on creating a new GitHub repository. You can create a repository at by following the below steps.

  1. Login to, go to the upper right corner and click on the “+” button.

How to Create a new Repository on GitHubPin

2. Click on New Repository

Please click Like if you loved this article?

Give Repository a simple name, say simple-web-app.
You can provide a description of the repository which you are creating, though this is an optional field.

Also, you can choose to make the repository either

  1. public – Visible to all
  2. private – Just to you
  • README – You also have an option to “Initialize this repository with a README”
    If selected a README.MD (markdown file) gets created in the repository and lies on the root.
    A README.MD file is nothing but a file that acts as a guide for the functionality of the repository. The README file is written in Markdown scripting.
    If you want to learn more on how to write a markdown page, please go throughout the tutorial on Markdown.
  • .gitignore– While creating a repository, we may want to block uploading certain files to GitHub Repository which we don’t require. For example, files getting creating on building the project. These files are system specific files which are different for different users.
    Such as target/* folder in a maven build java project.

For simplicity, let’s skip creating README and .gitignore for time being.
Hit “Create Repository”, a repository will be created.

See also
Create and Merge Pull Request


The repository will then be allocated a URL and will store all the source code.
The pattern of the URL follows[username]/[repository-name]

git init  

To be able to clone the project into different machines, we will use git clone command.
But first, let’s put our skeleton code into it.

Please click Like if you loved this article?

Open a “Terminal” in Mac or Unix, or in Windows using Command Prompt.

Navigate to the skeleton project, and initialize it as a git managed the project by typing.
Make sure you are inside the project folder.

$ git init


when we did “ls” to the file, it only enlisted index.html.

After a git init, it has created a hidden file called .git, which will maintain the state of git files and the branch.

We’ll discuss more on the branching in Upcoming tutorials. The intention of the current tutorial is to show how Git manages different states of the code files.

Git Add  

Let’s tell git to add up all the new/updated files to be able to push to GitHub.
Either we can specify file one by one or simply use “.” to represent all files.

Please click Like if you loved this article?

$ git add index.html


$ git add .

(. is used to specify all files)

git commit  

Now, we need to commit what changes that we have denoted git to do.
Every commit that we do, has a message which denotes, what was changed.
Since we added all the files to be able to push to GitHub
We commit these changes with a message by

$ git commit -m “Added index.html skeleton”

git push  

To push the changes, we need to execute the below command

$ git push -u origin master

origin – origin is a repository location where the code will be uploaded or pushed.
master – git maintain different branch, the master is the main branch, where we want the code to be pushed.

See also
Pushing changes to GitHub Repositories

Since there is no origin set, we need to set the remote origin first.

The URL is the location, appended with “.git” at the last.

Please click Like if you loved this article?

$ git remote add origin

In a nutshell, run the below command to push the local files to remote.

git init
git add.
git commit -m "Added index.html skeleton"
git remote add origin
git push -u origin master

The first time, you will need to enter the ID and password for GitHub.
Once set, it won’t ask for the password again.

Below you can see, our skeleton project’s file is added to the project.

PinAs you can see, the commit message is displayed with the username in GitHub Webpage.
We can configure the username and other attributes, which will be discussed in subsequent tutorials.


In this tutorial, we learn how to create a new repository on GitHub and publish our local project to the repository. In the Next tutorial, we’ll learn how to clone the published code into a different machine, make desired changes and publish them back to GitHub repositories.

Please click Like if you loved this article?

Ads Blocker Image Powered by Code Help Pro
Ads Blocker Detected!!!

This website does not work properly with AdBlock. We have detected that you are using extensions to block ads. Please disable Adblocker to view the content.