Skip to content

Clone a Repository

Overview

Download a copy of a repository from GitLab to your local machine.


Before you begin

Make sure:

  • you have access to the repository
  • you have the repository URL
  • Git is installed on your system

Steps

1. Open a terminal

Open a terminal on your local machine.


2. Choose a location

Navigate to the directory where you want the repository:

cd <target-directory>

3. Clone the repository

git clone <repository-url>

Replace <repository-url> with the URL provided by GitLab.


4. Enter the repository directory

cd <repository-name>

Verify

Check that:

  • the directory was created:
ls
  • files are present:
ls
  • the repository is connected:
git status

Troubleshooting

Permission denied

Possible causes:

  • no access to the repository
  • authentication not configured

Repository not found

Possible causes:

  • incorrect repository URL
  • repository does not exist
  • access not granted

Command not found: git

Possible cause:

  • Git is not installed or not available in your environment