How to clone a repository from GitHub

If you have a repository on GitHub, this can be considered as a remote repository. In order to work on it and develop new versions, it will be necessary to “clone” this repository in a directory on your computer, creating a local copy of all the files. So you will have a local repository. Once this copy has been made, the two locations will be synchronized with each other.

How to clone a repository on GitHub

Cloning the remote repository

Go to GitHub and select the repository you want to clone locally. Click on the Clone or Download button, and copy the HTTPS link suggested in the window below

Clonare un repository da GitHub 01

Open Git Bash and go to the directory in which you want to clone the repository

Clonare un repository da GitHub 02

Now to clone the repository in this folder, enter the following command

git clone

After a few seconds you will have the repository cloned on your computer.

Clonare un repository da GitHub 03

You can check the directory with all the files present locally

Clonare un repository da GitHub 04

Connection between local Repository and Remote Repository

Connect now (if we have not already done so) with GIt at GitHub.

git config –global "meccanismocomplesso" 
git config –global   

Changing the local repository

Now for testing, create a test file in the local repository.

Clonare un repository da GitHub 05

Synchronization between local repository and remote repository

When you have made all the necessary changes: created new files, modified existing ones; you can finally synchronize the two repositories, so that the changes will also result in the remote one.

 git add *git commit -m "first commit" git push  

At this point the two repositories will be perfectly synchronized.

Clonare un repository da GitHub 06

Leave a Reply