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

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.

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