Initial Setup

Guide for installing Git, configuring VS Code, and authenticating via SSH keys.

Install Git

  • Linux
# For CentOS/RHEL
sudo yum install git

or

# For Debian/Ubuntu
sudo apt install git
  • macOS (Homebrew)
brew install git
  • Windows

    • Download Git from the official website:
      https://git-scm.com/downloads or click here: Git
  • Verify Installation

git --version

VS Code Setup for Gitlab

Git integration is built into VS Code.

Install GitLab Extension

  1. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X).
  2. Search for GitLab Workflow.
  3. Click Install.

Set Git User

git init
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

SSH Authentication Setup

1. Generate SSH Key

ssh-keygen -t ed25519 -C "your_email@example.com"
  • Replace with your GitLab email address.

2. Save SSH_KEY

  • When prompted to “Enter a file in which to save the key,” press Enter. This will save the key to the default location or specify a custom one.

  • Default:

    • When prompted to “Enter a file in which to save the key,” press Enter. This will save the key to the default location.
    • The SSH key will be saved in the ~/.ssh directory.
    • The default file name is id_ed25519 or id_ed25519.pub
  • Custome:

    • /Folder_Path/file_name
    • Replace “Folder_Path” with the path where you want to save the key.
    • Replace “file_name” with the name you want to give to your key.
    • When prompted for a passphrase, press Enter without entering a passphrase.
    • This will save the key without a passphrase.
    • You can also specify a passphrase when prompted.
    • The passphrase will be used to encrypt the private key.

Default:

Private Key: id_ed25519
Public Key: id_ed25519.pub

3. Configure SSH Agent

eval "$(ssh-agent -s)"

4. Add Private Key to Agent

  • Default:
ssh-add ~/.ssh/id_ed25519
  • Custom:
ssh-add /Folder_Path/file_name

5. Add Public KEY to GitLab

Display Public Key

  • Default:
cat ~/.ssh/id_ed25519.pub
  • Custom:
cat /Folder_Path/file_name.pub
  • Add to GitLab:
    1. Log in to GitLab
    2. Go to Preferences -> SSH Keys
    3. Paste your public key
    4. Give it a Title and click Add key

6. Verify SSH Connection

ssh -T git@gitlab.com
  • Expected response:
    Welcome to GitLab, @yourusername!