How to make a Github clone using Javascript

img
Found a bug? No problem.
Instead of logging the issue, you can fix it yourself, using forks.
Forks are repository copies that gives you the opportunity to try things out without altering the original project. Forks are usually used to alter or to kickoff your project from the projects of others. You can create branches with your forks which enables you build a new feature without affecting your main project. Also, you pull requests if you intend contributing to the original repository by sending the author a pull request.

A two-stepped process is just what is required to fork a repository.

    1. Get on Github website. In this article we will be using the octocat/Spoon-knife repository as a sample.
    1. Click on Fork, which is found on the top-right of the screen.
      Done! octocat/Spoon-knife repository is forked.

Syncing

Forking is done for different reasons.
Whatever reason you have to fork a repository, syncing your fork with the original repository is undoubtedly a good practice.
In order to achieve this, you need to perform a set of actions.

1.Gitting up

A Git is needed on the command line for syncing the original repository.
Remember to set authentication from Git to Github.

2.Cloning

After forking the octocat/Spoon-knife on your computer, you do not have a local copy of the octocat repository fork. That brings us to cloning, this is carried out to get a local copy of the forked files.

    1. Goto your fork of octacat repository on Github.
    1. Download or select Clone, this should be done under the repository name.
    1. Copy the URL of the clone under the section of Clone with HTTP's then Open and type git clone.
    1. Paste the previously copied URL and hit ENTER!

Done! You now have your local files of your forked repository.

3.Syncing the original repository with your fork

When we carry our forking to posit a change, Git can be configured to make changes into the fork's local clone from the original repository.
We can do this by;

    1. Goto your fork of octacat repository on Github.
    1. Download or select Clone, this should be done under the repository name.
    1. Copy the URL of the clone under the section of Clone with HTTP's then Open
    1. Change the directory to the cloned fork's location (the fork earlier cloned by you).
    • Type cd to get to the home directory and move up one directory.
    • Type ls to list all the files and folders of the current directory
    • Type cd your_listed_directory to enter any directory being listed.
    1. Type git remote -v and hit Enter. The remote repository of the fork currently configured appears.
    1. Type **git remote add upstream and paste the URL copied above.
    1. Repeat step 5 to verify the your newly specified upstream repository. Your fork URL appears as the origin while the original repository's URL appears as upstream.

AUTHOR

READ NEXT

Boostlog is an online community for developers
who want to share ideas and grow each other.

Delete an article

Deleted articles are gone forever. Are you sure?