Sunday, May 1, 2016

GitHub Two

Copying, Downloading and Forking From Website


In this tutorial I will discuss how to get files from GitHub to use in your own coding.

Copying code


It is easy to copy code. Go to the repository with the code you want and then open the code file.Click on the Raw Button. This will give you the code as pure text, minus any formatting or web site information.

Raw Button

Once you have it in Raw view Select the code you wish to use and copy it.

Select from Raw

Downloading


Another way to get the code is simply to download it as a zip file. Once you have extracted it you can simply run the program--as long as all the dependencies such as Databases and other libraries are in place.

Download zip

Forking

Forking allows you to make a copy of someone's repository on your site. To do this I am going to go to another person's Repositories and Fork it to my own. I am going to use the site that Github uses in their tutorial, https://github.com/octocat/Spoon-Knife. I am not going to show Pull requests which allow you to notify the person you forked from and other interested uses of your changes to the original. I am also not going to go into how to keep the repositories in sync. For that look at the tutorial.

spoon Knife repository

Click the Fork Button. There is a please wait screen and then the code is copied to your GitHub site.

Forked Site

Windows Client


For the Windows client, I am just going to focus on cloning or copying a site. I will clone one of my own repositories onto my computer.

First, I will click the plus sign--the same one you use to create a new repository, only this time I will choose clone. From a drop down list of repositories on my site I select Inheritance Example Java.

clone dialog

Click the check mark and choose where to save the cloned Repository. Now the repository is on your computer.

If you want to clone someone else's repository, first fork it to your GitHub account, then clone it.

Command Line


To copy or clone a repository from the command line is really simple. It also has the advantage that you can copy someone else's repository without first forking it. Here is the command to copy that sample Spoon-Knife repository:

git clone git://github.com/octocat/Spoon-Knife.git

Here is the screenshot of the command console

Console clone

In the Third part we will look at version control

No comments:

Post a Comment