1
0
Fork 0
docs/articles/git/setup_configuration/Readme.md

52 lines
1.4 KiB
Markdown
Raw Normal View History

2024-06-09 16:30:22 +00:00
<a href="../../../Readme.md">
<img src="../../../common/back_arrow.png" alt="50" width="50"/>
</a>
# GIT - Setup and configuration
2024-06-09 16:28:12 +00:00
## Git setup
To clone this repository both [git](https://git-scm.com/downloads) and [git LFS (Large File Storage)](https://git-lfs.github.com/) must be installed on the target (host) machine:
```console
sudo apt install git git-lfs
```
To complete the configuration:
```console
git config --global user.name "<name surname>"
git config --global user.email "<e-mail address>"
```
## Repository configuration
To clone the repository via ssh:
1. Generate an SSH key pair using the following command. When prompted for passphrase press enter to leave the field blank.
```console
ssh-keygen -t rsa -b 4096 -C "<e-mail address>"
```
2. Add the ssh key to the ssh agent:
```console
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
```
3. Copy the ssh key to clipboard:
```console
sudo apt-get install xclip
cat ~/.ssh/id_rsa.pub | xclip -selection clipboard
```
4. Add the ssh key to GitLab account:
1. Access GitLab profile
2. Navigate to "Preferences" -> "SSH Keys" then press "Add new key"
3. Paste the text copied at the previous step in the "Key" field and remove the Expiration Date, then press "Add key"
5. Now the project can be cloned using the following command, specifying **"yes"** when promped for the ssh key:
```console
git clone git@gitlab.com:HMDrive/hmd_project.git
```