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 softwares are available on github. Because the communities of developers all over the world are contributing to these open source softwares. In order to remove the existing bugs and to improve and enhance the features.
So It depends on 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 lets 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 local repo. It will have the dummy files which were created before on 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 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 terminal.
Use git command ‘git init’ to initialize the local repository in your folder.
Once you do this, 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 create 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 files 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 learn how to clone github repo and setup 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 alot! Have any questions? comment below.