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
- Go to your GitLab repository in your web browser.
- Click the Clone button, which is usually located at the top-right of the repository page.
- Copy the URL provided. You can choose either the
HTTPS
orSSH
URL. It’s recommended to use SSH if you have configured SSH keys.
Step 2: Navigate to Directory
-
Open file explorer.
-
Navigate to the directory where you want to clone the repository. (eg:
C:\laragon\www
) -
Right-click and select Open in Terminal or Open in Git Bash.
- You can also open a terminal and navigate using
cd
command:
terminalcd path/to/directory
- You can also open a terminal and navigate using
Step 3: Clone the Repository
-
Run the
git clone
command to start:terminalgit 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
NoteUsing
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
-
Once the repository is cloned, you can access it using the following command:
terminalcd <repository_name>
Replace
<repository_name>
with the name of the repository you cloned. For example:terminalcd bedrock-starter
Step 5: Change local git config (Optional)
Change the local git config
by running the following commands:
git config --local user.email "[email protected]"
Example:
git config --local user.email "[email protected]"
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:
git config user.email