1
0
Fork 0

Added git configuration

This commit is contained in:
Luca Gambarotto 2024-06-09 18:28:12 +02:00
parent 1864afa66e
commit 71f36d15db
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
# Git setup and configuration
## 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
```