Github setup in simple steps

Share This:

Git and github may come across as complex at first but after a while it becomes natural. Years back I used local git repositories which required constant usage of CLI and you had to know what you are doing. These days github makes it much easier to understand and use. In about 10minutes you can have your code on github available for public use or private. Throughout my career I have noticed to have written hundreds of lines of code, new year resolution is to use git / version control from now on in conduction to github.

Step1.

Create github account: https://github.com

Step2.

Install git on mac by downloading .dmg

http://git-scm.com/book/en/v2/Getting-Started-Installing-Git

Set some global variables:

(this doesn’t have to be your git username)

(this must to be your github username!)

Step3.

Go onto Github portal and create your first repository, let’s call it devops

This is where you specify whether you’d like to make it public or not and choose whether to include README file.

Now it’s time to create a local directory on Mac where git project will be stored.

Now we can initialize git within that directory by changing to it and typing:

We can also create out first file which will get pushed to Github.

(we need to add the file in order to commit it)

now we can upload it onto github by defining our repository:

You will get prompted for credentials at this point.

Now you should be able to push your files onto github:

Sometimes you will find that error message pops out saying that your version is older than the one on the portal and to work around it use –force flag.

From now on once changes are made to devops.php file, you’ll need to commit that file first:

(. Points to this directory if executed where the file resides, otherwise path can be given as parameter)

and now again pushing the changes to the github:

Obviously more complexity comes with having many branches etc. but for the start this will do. Rome wasn’t build in one day.

 

 

 

Leave a comment

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

Time limit is exhausted. Please reload the CAPTCHA.