Git Tutorial
Git and GitHub
Git Contribute
Git Advanced
Git Undo
Git Clone from GitHub
Clone a Fork from GitHub
Now, we have created our own fork, but only on GitHub. We need a clone on our local Git to keep working on it.
A clone is defined as a full copy of a repository, that includes logging and versions of files.
Go back to the original repository, and click the green “Code” button to get the URL to clone:

Open the Git bash and clone the repository:
[user@localhost] $ git clone https://github.com/webhostguru/webhostguru.github.io.git
Cloning into ‘webhostguru.github.io’…
remote: Enumerating objects: 33, done.
remote: Counting objects: 100% (33/33), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 33 (delta 18), reused 33 (delta 18), pack-reused 0
Receiving objects: 100% (33/33), 94.79 KiB | 3.16 MiB/s, done.
Resolving deltas: 100% (18/18), done.
Check-in your file system, and it will be observed that a new directory named after the cloned project:
[user@localhost] $ ls webhostguru.io/
Navigate to the new directory, and check the status:
[user@localhost] $cd webhostguru.github.io
[user@localhost] $ git status
On branch master
Your branch is up to date with ‘origin/master’.
nothing to commit, working tree clean
Check the log to make a confirmation that do we have the full repository data:
[user@localhost] $ git log
commit facaeae8fd87dcb63629f108f401aa9c3614d4e6 (HEAD -> master, origin/master, origin/HEAD)
Merge: e7de78f 5a04b6f
Author: webhostguru
Date: Fri Mar 26 15:44:10 2021 +0100
Merge branch ‘master’ of https://github.com/webhostguru/hello-world
commit e7de78fdefdda51f6f961829fcbdf197e9b926b6
Author:webhostguru
Date: Fri Mar 26 15:37:22 2021 +0100
Updated index.html. Resized image
Now, a full copy of the original repository is available.
Configure Remotes
As, we have a full copy of a repository, whose origin we are not permitted to change.
How the remotes of this Git are set up is mentioned in the below example.
[user@localhost] $ git remote -v
origin https://github.com/webhostguru/webhostguru.github.io.git (fetch)
origin https://github.com/webhostguru/webhostguru.github.io.git (push)
The origin is set up to the original “webhostguru” repository, we also want to add our own fork.
Let’s rename the original origin remote:
[user@localhost] $ git remote rename origin upstream
[user@localhost] $ git remote -v
upstream https://github.com/webhostguru/webhostguru.github.io.git (fetch)
upstream https://github.com/webhostguru/webhostguru.github.io.git (push)
Then, fetch the URL of our own fork:

And add it as origin:
[user@localhost] $ git remote add origin https://github.com/webhostuser/webhostguru.github.io.git
[user@localhost] $ git remote -v
origin https://github.com/webhostuser/webhostguru.github.io.git (fetch)
origin https://github.com/webhostuser/webhostguru.github.io.git (push)
upstream https://github.com/webhostuser/webhostguru.github.io.git (fetch)
upstream https://github.com/webhostuser/webhostguru.github.io.git (push)
Now, there are two remotes:
origin – our own fork, where read and write access are available.
upstream – the original, where read-only access is available.