Skip to main content

Command Palette

Search for a command to run...

Cloning the Source from Github to Local Machine

Published
•2 min read•View as Markdown
V
  • Open Source Contributor
  • Loves Developer Education
  • Passionate about Developer Experience;
  • Currently working as Lead Developer at Zoho.

In our previous post we have see how to create a repo in Github.com. In this post Would like to introduce how to bring that repo from Github.com to the local machine, so you can make changes in your local desktop machine and later push them to the github.com so can view at any time.

Install the Git

  • First We need to Install the git in our machine.
  • Visit http://git-scm.com/download/ and choose your machine type, either Mac, Windows or Linux based
  • I use Ubuntu so I will type “apt-get install git” in my terminal
  • When password is asked give it, so the installation will get completed.

Cloning the repo to Machine

  • Then we have to clone the repo from Github to our localmachine Clone
  • Visit the repo page, in my case (https://github.com/viswaprasath/viswaprasath.github.io)
  • You can see HTTPS clone URL above Download Zip button
  • Below that a URL is given, copy that URL full you can click the button next to the url to copy the url.
  • Open Terminal & type the command

git clone https://github.com/viswaprasath/viswaprasath.github.io.git

In your case the url will be different. So you will be getting a folder in your machine with the name viswaprasath.github.io

Making changes

  • Go inside the folder
  • Create some files say index.html is mandatory
  • I have typed some lines in index.html so when visitor comes to my website he first will see it

Welcome to My Website


Hello World!!

So When visitors comes in he will see Hello World.

Sending Back to Github

  • After making the changes we have to upload the files to github. It is called as push (we send from local to github)
  • So first we have to add all the files we have changes. We can do it by type “git add –all”, so all files will be added.
  • Then we have to mention why we have added the files type ( git commit -m “Initial commit” ) where initial commit is the message, we can give any message here so we can understand easily.
  • Then “git push -u origin master” here we have only one branch as of now and that name is Master, so we are pushing our code to it.
  • So it will ask for your username and password.
  • Give them correctly. So all the code will be push.
  • After that give url in address bar (http://viswaprasath.github.io/) in your case it will change. You will see what you have written in index.html. I gave it as Hello World!
3 views