GitHub - Creating First Repo

Shameel Uddin's photo
Shameel Uddin
·May 29, 2022·

3 min read

Subscribe to our newsletter and never miss any upcoming articles

So, we have learned Basics of:

Time to move on and create our first repository on GitHub.

Creating First Repository on GitHub

Navigate to Repositories and click on New

Image description

Fill out basic info:

Image description

These two are compulsory:

  • Repository Name
  • Selection of Public and Private

Public Repository is seen by everyone where as Private Repository is only visible to you.

Once you are done, click on Create Repository:

Image description

Options in Creating Repository

Generally you are provided with three options.

Option 1 is used when you want to begin from scratch

Option 2 means that you are already working and just want to push the project on GitHub

Option 3 means to import a repository from somewhere else.

Create New Repository in CLI

You just need to enter the following commands as shown in option 1 in Git Bash.

Image description

Most of the commands have already been studied in our article where we got out basics of Git straight.

Lets rewind them a bit..

  1. echo "# test-repo" >> This creates file in the folder/directory you are present in and save "# test-repo" as its contents in the file.

  2. git init This initializes the git repository in folder/directory you are present int.

  3. git add file which was created as a result of first command is now added to Staging Area

  4. git commit -m "first commit"

This commits the changes with the message first commit.

  1. git branch -M main This creates a branch called as main. Note: We are always working in a branch; default branch is main.

So far, we have done stuff that we already knew. Time to move on to the remote commands.

  1. git remote add origin

This creates a pointer. Key of pointer is origin Value of pointer is

One of the benefits the key origin provides, is that, you do not have to memorize the whole URL, you can just use the short name.

You can name anything other than origin but this is a conventional and/or standard way so just go with the flow because if you move away from conventions/standards, it'll be difficult for others to maintain/upgrade/fix your projects.

Similarly, you can add as many pointers as you want. You can download project/changes from one (remote location) pointer and push it to another pointer (remote location)

You can find out about remotes with git remove -v command: Image description

  1. git push -u origin main This command pushes (uploads) changes to origin which are present in main branch.

Pushing Changes First Time

If you are pushing changes first time then you will be required to log in. Image description Image description Do not worry about this step, because, you need to authenticate that you have the rights to push changes to the selected repository.


This is what you see in your CLI after you have successfully authenticated yourself and pushed the changes.

Image description

Refresh the page on GitHub.

This is what you see on your GitHub repo page: Image description

That's it folks!

Lets meet again and discuss most important remote git commands for daily usage.