How to upload code to Github?

How to upload code to Github?

Well, there are two ways to do that :

  1. Through UI of website
  2. By typing in commands from the command line

Though it is absolutely fine for beginners to use the first method and then shift to the command line and hence we are going to look both ways to do that and very basics of them.

So, I assume you have a project which you want to upload or basically a folder in which some files are present and if not, then create one following this:

Make a folder name ?project-01?, inside that create a file index.html and write anything there doesn?t matter, we just need to upload that cool thing.

Now, go to and make your account, make sure you put a cool username as you are going to be the next geek master of your college.


Move your eye to the upper right corner of the website and click on this plus sign and then click on the New repository.

Image for postcreating repository: step-1


A screen will open as below, give your repository a name, keep it public and click on the checkbox displaying ?Initialize this repository with a README? .

Image for postcreating repository: step-2


This screen should come up, if it is not coming make sure in the last step, you clicked the checkbox saying initialize it with readme. Now, in right side see a button saying upload files. Click on that

Image for postcreating repository: step 3


Below screen will come, now click on the ?choose your files? link and move inside the folder project-01 and select all the files at once. And after that at bottom, a form will come, there type your message. For e.g., ?completed the website? and leave the description part and click on commit changes button.

Image for postpushing code: step-4

After this step your code will be uploaded to github and now you can share your link to anyone saying, look at my awesome work here.


If you are satisfied by uploading files through UI, its cool leave this section but if you want to know how you can do same using the command line or a software called git, come on with me.

Go here and download the software i.e git for your operating system(No need to download if you are using Linux). Now, go inside the folder project-01. If you are using windows, upon right click inside that folder, an option will be there, ?open git bash here? click on that and a black screen will appear. If you?re on Linux, move inside project-01 directory through terminal.

Now scroll up and continue with step-1, but in step-2, this time, don?t click on the checkbox showing ?Initialize this repository with a README? and click on create repository. Now a screen like this will appear

Image for postwith git bash

Now, go back to your black screen( or terminal or command line), and start copying and pasting these code snipetts,

echo ?#test2″>>

git init

git add .

git commit -m “first commit”

git remote add origin

git push -u origin master

This will push your code to the Github in the same way as we have done in the METHOD-1, make sure you replaced the your_username and repo_name with your username and repository name.

So, this is all. I showed how to upload code to github which was the title of this article but I have not explained anything why we are doing this step, because I don?t want to make this more tough for you, one step at once, now with time you will learn why you wrote git init, what is git remote and push, that all are with git.

If you want me to write further on this, let me know through comments. Thank you !!

No Responses

Write a response