From 71f36d15db07a1a0202a7c38612404fd1df8ae50 Mon Sep 17 00:00:00 2001 From: Luca Gambarotto Date: Sun, 9 Jun 2024 18:28:12 +0200 Subject: [PATCH] Added git configuration --- articles/git/setup_configuration/Readme.md | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 articles/git/setup_configuration/Readme.md diff --git a/articles/git/setup_configuration/Readme.md b/articles/git/setup_configuration/Readme.md new file mode 100644 index 0000000..cea05f5 --- /dev/null +++ b/articles/git/setup_configuration/Readme.md @@ -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 "" +git config --global user.email "" +``` + +## 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 "" +``` + +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 +``` \ No newline at end of file