Git SSH with GitLab self-managed instances
GitLab Community Edition is open source. Anyone may host their own self-managed GitLab instance if desired instead of gitlab.com. Git SSH. For this example, we use Kitware’s CMake GitLab instance.
First, create an account on the self-managed GitLab instance and fork the desired repo. This will be available like
git clone https://gitlab.kitware.com/username/cmake
To git push using SSH, type:
git config --global url."ssh://gitlab.kitware.com/".pushInsteadOf https://gitlab.kitware.com/
Generate an SSH key–don’t reuse SSH keys between sites.
ssh-keygen -t ed25519 -f ~/.ssh/kitware
Go to the GitLab SSH Key page and add the contents of ~/.ssh/kitware.pub
Add to ~/.ssh/config:
Host gitlab.kitware.com
User git
IdentityFile ~/.ssh/kitware
Now checkout a new branch, make your changes according to project guidelines and submit a merge request.