Git SSH Public key Authentication
Git hosting services including GitLab and GitHub can use Git over SSH for enhanced security.
Setup the file “~/.ssh/config” for Git SSH Public Key authentication like:
Host *
IdentitiesOnly yes
PubKeyAuthentication yes
Host gist.github.com
User git
IdentityFile ~/.ssh/github
Host github.com
User git
IdentityFile ~/.ssh/github
Host gitlab.com
User git
IdentityFile ~/.ssh/gitlab
Set file permissions if needed:
chmod 400 ~/.ssh/config
Create Git SSH key like:
ssh-keygen -t ed25519 -f ~/.ssh/github
For speed, consider Git pull over HTTPS, Git push over SSH.