What is GitHub and How to push your code on GitHub ?

In this tutorial, we are going to learn more about what is GitHub, how it works and how to use it to save your code online.

This post is in continuation of our “Introduction to Git” post. You can check it to understand this post better :

Introduction to Git and creating your Git repository

What is GitHub ?

GitHub is an online hosting service which is basically used to store your code on cloud with all the changes ever happened during its development.

GitHub makes use of Git; but while Git is just a command line tool, GitHub is more of a Graphical Based web service.

It is also known as a Social Networking site for developers because it facilitates Social code building between developers while working on a common project.

Pushing your Code to GitHub

Open up github.com and create a new free account.

Then, in the upper right-hand corner, click on the + sign and select for a New Repository.




create new repository on github

The next window will open something like this :

github create repository

Set up a suitable Repository name.

Leave the “Initialize this repository with a README” option unchecked.

Set the “Add .gitignore” option as None if you have set it already using command line; otherwise set the desired option according to your Project.

Further, leave the License as None.

Now, we need to attach your Git Repository to one on GitHub.

Open up your Terminal/Console and run :

git remote add origin https://github.com/<your-username>/<your-repository-name>.git
git push -u origin master

After this you will be asked for your GitHub credentials; enter them and if everything went fine, you will see something like this.

Counting objects: 16, done.
Writing objects: 100% (16/16), 23700 bytes | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To https://github.com/aayush-05/my_django_project.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Hurray! Your code is now saved on GitHub.

Feel free to drop any doubts/queries in the comment section below.

Also, check out our other posts :


Leave a Reply

Your email address will not be published. Required fields are marked *