How to upload your code to GitHub? | Recent Blogger


Are you a developer either by profession or a person who codes for passion? Then this post is for you! Let's have a look at GitHub in detail. 

What is GitHub?

GitHub is a web-based interface that uses Git, the open-source version, which helps with version control. It helps and makes it easier for multiple people to work on the same projects, and also to make modifications for the project.

With GitHub, developers can track code changes, which can be really helpful. Having Git and GitHub skills can be an added advantage at interviews.

Even if you are a beginner don't worry, you can easily follow this tutorial and push your first code to GitHub.

First, you will need a GitHub account. If you don't have one yet, you can create one here.

Once a GitHub account is created, we can proceed further. There are two ways to upload your code to GitHub.

  • GitHub UI
  • Using Command Line

These steps can really help beginners to understand quite fast. So, opt for the way that suits you either GUI or command line.

I assume you have a project to upload. If not, then create a simple Python project here. Once you have a project ready we can move on to the next steps.

METHOD - 1 ( GitHub UI )


Now, we shall go to

The first thing is to create a repository. Check out the below image fig.1, and click the plus icon > New repository.



Below screen shall open fig.2, give your repository a name, add a description, you can either keep your repository Public/Private

Choose accordingly and check "Initialize this repository with a README", and finally click on Create Repository.



Now your screen should appear as fig3, then we are good to proceed with uploading files by clicking on Add File > Upload files.



Here we shall drag and drop the files /choose your files by clicking on the hyperlink fig4.


Input your message, description and hit on commit changes.

Here we go, we have finally uploaded our code files to Github. Now go forward and share your repository link to dev enthusiasts around the world, who can make use of your code, or enhance it by making a few modifications or fixing the bugs.

METHOD -2 ( Using Command Line )

Good, we're done using the GUI (Graphical User Interface), but more developers would prefer using the command line. So, let's get started with the command line for uploading files to GitHub using git.


You'll have to install Git from here, for your desired operating system  fig5. And then create a repository same as shown in fig1 & fig2.



Now open git Bash from your windows search, and then navigate to the project folder path,

cd into the project folder. eg: cd /Desktop/projectfiles/demo


Type git init to initialize the repository.

Add the files to the repository by using git add . (followed by a period '.')

Type git status to view the files which are going to be staged. On your first commit.

Commit the files staged using git commit -m "my first commit".

'-m' flag used for setting the message or a description.

Now copy the repository's URL from Github fig6.


Add the URL copied in git remote .add origin<username>/<repository-name>.git

On the URL, username & repository-name shall vary.

Next, push your code into your local repository using git push-u origin master

'origin' is your default remote repository name '-u' flag is upstream.

Cool! Go to Github and into your repository, you should see your code files now.

Your awesome code is now on Github which you can share and allow others to modify your code.

Hope you find the article useful! In upcoming posts we'll post more detailed Git uses. Stayed tuned! 

For more posts do check out here.

Post a Comment


  1. Wonderful article, Which you have shared about the upload your code to GitHub. Your article is very important and I really enjoyed reading it. Get for more information Database Programming Online Help

  2. Great Blog! This post gives a better idea. Thanks for the useful information. erp software companies