Github tutorial

Everything you need to start with Github

This tutorial is all about Github – An online source code management system and social code sharing community. Whether you are a computer professional or college kid you should have Github as skills added in your resume.

Let’s go back to history ! We all know about Linux, a revolutionary OS with lot’s of possibilites. During it’s development there were thousand’s of developer around globe working on it. Then the need of source code management arises and result is a piece of software called ‘Git‘ originally written by super smart guy Linus Torvalds.

External link: Linus torvald explains GIT in Google Conference.

Let’s start with Github. I am using Ubuntu 14.04 in which GIT is placed in Kernel. If you are Mac user (most probably you are !) then it may be integrated in system (check by typing git on console) or you can download it from here.

Same step goes for Windows user’s and people using Windows must download Git first before moving ahead with tutorial.

External link: Download Git for Mac and Window.

Step 1: Create Account on Github.com

To be able to share your work with other’s you have to create your account. Step is simple and very quick cause registration form have only 3 fields. Go to Github.com and create your account.

Step 2: Create Repository on Github.

Repository ( or directory, folder etc) contains your project. You can add,delete,editand most important share the repository. Browse to ‘+’ button on right side of your name in top bar and click on ‘New Repository’.

New repository

Give it a proper name. Don’t go for too long one. Then save it and keep the browser tab open. This is what i got.

Repository of Github

Step 3: Adding project to Repository.

Here come’s an interesting part. Let’s add one dummy project into our repository. Create any folder and add any file (text,php,html,node.js etc whichever you want) into it. Once you have done adding file then follow steps below.

Open up your terminal or console or command prompt depending upon your operating system. Switch to the folder you have created using CD <Your folder name>.

Type following commands one by one in your terminal. I will explain them in next section.

git init
touch README
git add .
git commit -m "Hello my first commit"

Now following commands are very important and used to upload your project into repository you have created on Github.

git remote add origin https://github.com/Your_User_name/your_repository_name.git

After this final command.

git push origin master

It will ask you to provide your username and password which you have used to create Github account. Here is screen shot for help if you stuck.

Complete GITHUB command

Hey ! you have done with adding repository. Just go to Github.com and check it. Now as promised above, here is an explanation of each command.

First command start the Git. Second command Create one file which is require for Github.com. You can edit it and put details about your project such as installation details or external links or any kind of information you want. Third command Add all of the file in current directory (sub directories are also included if it is there in your project).

Now we have added the files to Git, it’s time to save the changes and commit it. You can relate “commit” operation with finalizing operation, a phase where project is ready to deploy.

In next two command we have point our Git to Github repository and Push it into it by providing our valid Github account credentials. After successful execution of command just refresh Github page and you may be able to see what i have got down here.

Final step to add repository

If above steps are too long and you prefer video over it then watch it here. Yes this channel is official codeforgeek channel.

Shahid (UnixRoot) Shaikh

Hey there, This is Shahid, an Engineer and Blogger from Bombay. I am also an Author and i wrote a programming book on Sails.js, MVC framework for Node.js.

Related Posts

Leave a Reply

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