In this tutorial, I will teach you how to clone Github repo by using terminal on windows. We all have heard the hype of Github. Why we haven’t heard about it. It is the number one world’s leading software development platform. Therefore the code of most of the open-source software is available on GitHub. Because the communities of developers all over the world are contributing to these open-source software. In order to remove the existing bugs and to improve and enhance the features.
So It depends on the repo owner whether to accept the contribution or discard the changes. This is called a “pull request” by the contributor to the owner of the repo. Which I will cover in another tutorial later on. For now, let’s jump into the tutorial and get started.
For example, I will create a remote repository on Github. I will create some dummy files in the repo and then I will clone that remote repository from Github to the local repository. But Once the repository will be cloned on the local repo. It will have the dummy files which were created before on a remote repository.
At the end of the tutorial, you will know
A. How to create a remote Github repository
B. How to connect to Github repository
C. How to initialize a local repository
D. How to clone Github repo
Steps 1: Create a remote repository
I’m assuming that you have signed up to Github after login, click on the ‘+’ icon placed on the top right.
Once you click on ‘+’ and select ‘New repository’ you will be directed to the page below asking for new repository details which is to be created. Enter new repo name, description and check to initialize the repository with a README.md file created. Leave the radio button at public as it is.
Once you will click on ‘Create Repository’ button, Congratulations! your new remote repo will be created.
Step 2: Create a local repository
To create a local repository, write cmd on the instead of path in the directory (folder) you wanted to be a git local repository and press ‘enter’. This will give a path of your local git repo to the terminal.
Use git command ‘git init’ to initialize the local repository in your folder.
Once you do this, a local repository has now been initialized and ready to use.
Step 3: Clone Github Repo to Local Repo
I have made some .txt files (notepad files) File 1 and File 2 by creating a new file option on the remote repository just to show you that the repository and all its files will be cloned to your local repository.
(ignore if remote repository already have filed, this is just for demo purpose)
How to Clone Github Repo
Go to Github and copy (clone) the URL of your remote repository
Open the terminal and type the following command to clone.
‘git clone URL (Copied from Github)’
Congratulation! You have just learned how to clone Github repo and set up on your local repository. You can see below the whole remote repository is cloned, including File 1 and File 2 we had created on Github remote repository.
Furthermore, it is to be noted that first time pulling the remote repository is known as ‘clone’. While doing after that will be just a pull command to fetch the data from the remote repository.
See you in another great tutorial. I’m sure it will help a lot! Have any questions? comment below.