You don't need a GitLab account to use Git locally, but for the purpose of this guide we
To start using GitLab with Git, complete the following tasks:
recommend registering and signing into your account before starting. Some commands need a
connection between the files on your computer and their version on a remote server.
You must also open a [terminal](#open-a-terminal) and have
- Create and sign in to a GitLab account.
[Git installed](#install-git) on your computer.
-[Open a terminal](#open-a-terminal).
-[Install Git](#install-git) on your computer.
-[Configure Git](#configure-git).
-[Choose a repository](#choose-a-repository).
### Open a terminal
### Open a terminal
To execute Git commands on your computer, you must open a terminal (also known as command
To execute Git commands on your computer, you must open a terminal (also known as command
prompt, command shell, and command line) of your preference. Here are some suggestions:
prompt, command shell, and command line). Here are some options:
- For macOS users:
- For macOS users:
- Built-in: [Terminal](https://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line). Press <kbd>⌘ command</kbd> + <kbd>space</kbd> and type "terminal" to find it.
- Built-in[Terminal](https://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line). Press <kbd>⌘ command</kbd> + <kbd>space</kbd> and type `terminal`.
-[iTerm2](https://iterm2.com/), which you can integrate with [zsh](https://git-scm.com/book/id/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh) and [oh my zsh](https://ohmyz.sh/) for color highlighting, among other handy features for Git users.
-[iTerm2](https://iterm2.com/). You can integrate it with [zsh](https://git-scm.com/book/id/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh) and [oh my zsh](https://ohmyz.sh/) for color highlighting and other advanced features.
- For Windows users:
- For Windows users:
- Built-in: `cmd`. Click the search icon on the bottom navigation bar on Windows and type `cmd` to find it.
- Built-in command line. On the Windows taskbar, select the search icon and type `cmd`.
-[PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-7): a Windows "powered up" shell, from which you can execute a greater number of commands.
Remember to replace the example URLs with the relevant path of your project.
To get started, choose one of the following:
1. Authenticate with GitLab by following the instructions in the [SSH documentation](../ssh/README.md).
1. Go to your project's landing page and select **Clone**. Copy the URL for **Clone with SSH**.
1. Open a terminal and go to the directory where you want to clone the files. Git automatically creates a folder with the repository name and downloads the files there.
1. Run this command:
- Use the example project by signing into GitLab.com and [forking](../user/project/repository/forking_workflow.md#creating-a-fork)
```shell
it into your namespace to make it available under `https://gitlab.com/<your-namespace>/sample-project/`.
- Copy an existing GitLab repository onto your computer by [cloning a repository](#clone-a-repository).
```
- Upload an existing folder from your computer to GitLab by [converting a local folder into a Git repository](#convert-a-local-directory-into-a-repository).
### Clone a repository
1. To view the files, go to the new directory:
To start working locally on an existing remote repository, clone it with the
```shell
command `git clone <repository path>`. You can either clone it using [HTTPS](#clone-using-https)
cd sample-project
or [SSH](#clone-using-ssh), according to your preferred [authentication method](#git-authentication-methods).
```
You can find both paths (HTTPS and SSH) by navigating to your project's landing page
You can also
and clicking **Clone**. GitLab prompts you with both paths, from which you can copy
[clone a repository and open it directly in Visual Studio Code](../user/project/repository/index.md#clone-and-open-in-visual-studio-code).
and paste in your command line. You can also
[clone and open directly in Visual Studio Code](../user/project/repository/index.md#clone-and-open-in-apple-xcode).
For example, with our [sample project](https://gitlab.com/gitlab-tests/sample-project/):
### Clone with HTTPS
- To clone through HTTPS, use `https://gitlab.com/gitlab-tests/sample-project.git`.
Clone with HTTPS when you want to authenticate each time you perform an operation
- To clone through SSH, use `git@gitlab.com:gitlab-tests/sample-project.git`.
between your computer and GitLab.
To get started, open a terminal window in the directory you wish to add the
1. Go to your project's landing page and select **Clone**. Copy the URL for **Clone with HTTPS**.
repository files into, and run one of the `git clone` commands as described below.
1. Open a terminal and go to the directory where you want to clone the files.
1. Run the following command. Git automatically creates a folder with the repository name and downloads the files there.
Both commands download a copy of the files in a folder named after the project's
```shell
name and preserve the connection with the remote repository.