uabrc.github.io icon indicating copy to clipboard operation
uabrc.github.io copied to clipboard

Git Lab Documentation

Open jgordini opened this issue 2 years ago • 0 comments

What would you like to see added?

When logging into GitLab via SSH, you're generally not logging into the web interface of GitLab itself but rather interacting with the Git repositories hosted on GitLab. SSH is used to securely push, pull, and otherwise manipulate your Git repositories. Below are the general steps to log into GitLab using SSH:

Prerequisites

  1. Git installed on your local machine.
  2. A GitLab account.

Steps

  1. Generate SSH Key Pair: If you don't already have an SSH key pair, you can generate one using the following command:

    ssh-keygen -t ed25519 -C "[email protected]"
    
    • -t ed25519 specifies the type of key to create.
    • -C "[email protected]" provides a label or comment for the key.
  2. Add SSH Key to ssh-agent: Make sure ssh-agent is running, and add your SSH key.

    eval "$(ssh-agent -s)"
    ssh-add ~/.ssh/id_ed25519
    
    • eval "$(ssh-agent -s)" starts the ssh-agent in the background.
    • ssh-add ~/.ssh/id_ed25519 adds the SSH key to the ssh-agent.
  3. Copy Public Key: You can display your public key with cat ~/.ssh/id_ed25519.pub, then copy it to your clipboard.

  4. Add SSH Key to GitLab

    • Go to GitLab and log in.
    • Navigate to "User Settings" -> "SSH Keys".
    • Paste your copied public key into the "Key" field and save.
  5. Test Connection: You can then test your SSH key pair connection to GitLab with the following command:

    ssh -T [email protected]
    
    • If successful, you will see a message like "Welcome to GitLab, @username!"
  6. Clone Repository: Now you can clone a Git repository from GitLab using SSH.

    git clone [email protected]:username/repository.git
    
    • Replace username and repository with the appropriate values.

And that's it! You've successfully logged into GitLab using SSH for Git operations. Note that these steps are tailored for a Unix-like system such as Linux or macOS. The steps may vary for Windows.

jgordini avatar Oct 12 '23 18:10 jgordini