Skip to Content

Clone a Repository

Here’s a simple guide to help you copy a GitLab project onto your computer. This way, you’ll have your own version to work on, right from your machine.

Prerequisites

  • Git installed: Make sure Git is installed on your machine. You can follow this guide.
  • Access to GitLab: You should have an account on GitLab and the appropriate permissions to access the repository you want to clone.

Get Started

Step 1: Find the Repository

  1. Go to your GitLab repository in your web browser.
  2. Click the Clone button, which is usually located at the top-right of the repository page.
  3. Copy the URL provided. You can choose either the HTTPS or SSH URL. It’s recommended to use SSH if you have configured SSH keys.

Step 2: Navigate to Directory

  1. Open file explorer.

  2. Navigate to the directory where you want to clone the repository. (eg: C:\laragon\www)

  3. Right-click and select Open in Terminal or Open in Git Bash.

    • You can also open a terminal and navigate using cd command:
    terminal
    cd path/to/directory

Step 3: Clone the Repository

  1. Run the git clone command to start:

    terminal
    git clone <repository_url>

    Replacing <repository_url> with the one you copied in Step 1. For example:

    terminal
    # using SSH git clone [email protected]:training/training-ap-panorama.git # using HTTPS git clone https://my_username:[email protected]/agentimage-demo/bedrock-starter.git
    Note

    Using HTTPS will need Personal Access Tokens if 2FA is enabled on your GitLab account, otherwise you can use your password.

Step 4: Access the cloned repository

  1. Once the repository is cloned, you can access it using the following command:

    terminal
    cd <repository_name>

    Replace <repository_name> with the name of the repository you cloned. For example:

    terminal
    cd bedrock-starter

Step 5: Change local git config (Optional)

Change the local git config by running the following commands:

terminal
git config --local user.email "[email protected]"

Example:

terminal
git config --local user.email "[email protected]"
🚫
Important

You need to use your work email address, not your personal email address as this will be used when committing your changes.

Verify changes by running, you should see your updated email address:

terminal
git config user.email

Video link

Last updated on