Connect to GitLab via SSH

Start an ssh-agent

If not yet done add to your rc-file ike .bashrc or .zshrc

$ eval `ssh-agent`

Add your generated key

$ ssh-add ~/.ssh/id_rsa

List keys

$  ssh-add -l

4096 SHA256:nX1hSWQ5bSSjx8OcF5WmrOvq2SSnXe2Neg2y1xH0KYQ ctang@refpad-16 (RSA)

GitShell anyone?

GitLab should response with git-shell. You shall log in by git-user only!

$ ssh -T git@myserver.lab
Welcome to GitLab, Markus Geiger!

You should not get an Interactive Shell like sh!

Git Version> 2.2
GIT_SSH_COMMAND="ssh -vvv -T git@gitserver" GIT_TRACE=2 git clone git@gitserver/foo.git
Git Version < 2.2

# Debugging

ssh -vv -i privatekey -l git $@
GIT_SSH="sshwrapper-script" GIT_TRACE=2 git clone git@gitserver/foo.git

Other way

git config --global credential.helper cache

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.