Clone a Git Repository¶
This guide explains how to clone an existing Git repository from GitHub to your local workstation.
Prerequisites¶
- Git installed on your system.
- Access to the GitHub repository you want to clone.
- (Optional) SSH key configured for GitHub if you prefer SSH authentication.
Steps¶
-
Open Terminal
Navigate to the directory where you want to clone the repository: -
Get the Repository URL
- Go to the GitHub page for the repository.
-
Click the Code button and copy the URL (choose HTTPS or SSH).
-
Clone the Repository
-
Using HTTPS:
You will be prompted for your GitHub username and password (or personal access token). -
Using SSH:
SSH authentication uses your configured SSH key pair. -
Result
Git will download the repository and create a local copy in the specified directory. The process duration depends on the repository size and your internet connection.
Notes¶
- Replace
<username>
and<repository>
with the actual GitHub username and repository name. - For SSH, ensure your public key is added to your GitHub account (GitHub SSH setup guide).
- After cloning, you can navigate into the project folder and start working:
Troubleshooting¶
- If you encounter authentication errors, verify your credentials or SSH key setup.
- For private repositories, ensure you