Clone a repo
Categories:
2 minute read
To view/edit code hosted in GitHub on your own system you can clone the repository which basically means you download the repository from GitHub.
In Terminal on your workstation, navigate to the directory where you want to clone the repository. For example, if you want to clone the repository into a directory called “myproject”, you can use the following command:
cd a-project
Go to the GitHub website and navigate to the repository that you want to clone. Click the “Clone or download” button and copy the URL for the repository. You can use either the HTTPS URL or the SSH URL, depending on how you want to authenticate with GitHub.
In your Terminal on your workstation, run the git clone
command followed by the repository URL. For example, if you want to clone a repository using HTTPS authentication, you can use the following command:
Replace “yourusername” with your GitHub username and “yourrepository” with the name of your repository.
git clone https://github.com/yourusername/yourrepository.git
If you want to clone a repository using SSH authentication, you can use the following command:
git clone git@github.com:yourusername/yourrepository.git
If you’re cloning a repository using HTTPS authentication, Git will prompt you to enter your GitHub username and password. If you’re cloning a repository using SSH authentication, Git will use your SSH key pair to authenticate with GitHub automatically.
Git will download the entire repository and create a local copy on your computer. Depending on the size of the repository and your internet connection, this process may take some time.