Setting up GitLab on HCC Clusters

The easiest way to use GitLab on HCC clusters is by adding SSH keys to your account.

These steps must be repeated for each cluster that you wish to use the service on.

After you have setup your GitLab account, follow these steps to add SSH keys to your account:

  1. Login to the cluster that you wish to set up GitLab access on.

  2. Check for an existing key by typing the command:

        cat ~/.ssh/id_rsa.pub
        

    If you see a long string of characters starting with ssh-rsa then you can skip step 3 and proceed directly to step 4.

  3. Generate an SSH Key pair with the command below, replacing your_email_here with the email you used to login to GitLab:

        ssh-keygen -t rsa -C "your_email_here"
        

    This command will prompt you for a location and filename to store the key pair and for a password. When prompted for the location and filename, just press enter to use the default. If you use a different name, the key will not be used automatically.

    Note: It is a best practice to use a password for an SSH key, but it is not required and you can skip creating a password by pressing enter.

    If you want to change the password of your key later, you can use the following command:

        ssh-keygen -p <keyname>
        
  4. Retrieve your public key with the command:

        cat ~/.ssh/id_rsa.pub
        

    Copy all the text after the command (starting with ssh-rsa) to but not including the next prompt (ending with your email address).

  5. Add the public key to your GitLab account by navigating to your Account Information screen. After logging in, click the arrow next to your profile icon in the top right corner. Click on Profile Settings.

    Then click SSH Keys from the top menu.

    Paste your copied key into the Key box. The Title box will automatically populate with your email. You can accept this title or change it to a custom title of your choosing. We recommend adding the cluster name to the title so you can easily identify what key is associated with a particular machine.

    Click the Add Key button to save the key to your account.

Now you can clone and push repositories as usual. When pushing to an existing repository, you will be prompted for the passkey associated with the keys (if you added one).