Setup or upload your local project to GitHub using command line

Abhigyan Singh 03rd Oct 2020

GitHub is very useful for developers to share or back up your project. You can live your project by making a repository on GitHub and share among to multiple developers. You can easily set up GitHub using the command line and upload your local project to GitHub repository.

It also facilities to see any changes and also can see who is changing in your project. You will notify by mail if any changes are done in your project and who has changed. It is useful to take a backup of your project on regular basis without using the space of your server.

Step to step guide to setup your local project to GitHub using command line

GitHub provides both interface GUI and CLI. In this article, we will use command line interface to upload local your project and for making changes. Firstly we create an account on GitHub after that we make a small project on local and will upload on GitHub. These are the following steps to set up your project on GitHub as follows:

Also read: How install GitHub desktop on your on Windows, Mac, and even Linux machine

1. Go to https://github.com/. Click on the Sign up button and fill your required details and click on Create an account button.

2. Choose your plan according to your need. For starting I would recommend unlimited public repository for free which is default option  and click on continue button as shown below:

3. After clicking continue button you can skip next option then will have following screen as shown below. Click on Start a project button it will say for verify email address. Verify your email address and start to make repository.

4. When you click on start project button will have following screen as shown below. Click on create repository button then it will redirect you to a quick setup page which will see in the next step.

5. After clicking on the create repository button will have the following screen with the various command which we use in cmd or command prompt to upload the project on GitHub.

6. To run commands of git on command prompt we have to install git on your local system or computer and set it into window environment variables. You can download git from https://git-scm.com/download. By default, it will install in your program files of c drive and set this path in environment variables as shown below. Here we are showing how you can set path in environment variables:

  • Right-click "My Computer",
  • Select "Properties",
  • Open "Advanced",
  • Click "Environment Variables",
  • Highlight the "Path" variable,
  • Click "Edit",
  • Add your specific path to the front of the "Variable value" field, separated by a semicolon from the existing entry. Do not add a space between; and last entry

Like path - C:\Program Files\Git;

We are attaching here image for your better understanding and can do this thing by seeing this image:

7. Now let's make a new project with one HTML file on the local machine which will be uploaded on GitHub Repository. In my case project name is discussdesk which contains one file called demo.html with dummy content as shown below:

8. After setting the path variable close your cmd or command prompt and open again. Run the following command one after one as shown below. One thing to remember here you should be in the working directory or folder which you want to upload or live in GitHub. In my case folder name is discussdesk and it is located in htdocs folder of xampp.


Now you will refresh your Github repository or folder you will get your all local files and folder on GitHub Repository as shown below.

GitHub Repository

I hope you can do this thing itself still have any confusion or want to know more about Github then please comment below. We will always happy to help you.

Authored By Abhigyan Singh

He is a continuous blogger and has blogged on different topic. He loves to surf Internet and always trying to get new Idea about new Technology and Innovations and sharing these great information to all the technology lovers.

Also on DiscussDesk