1. Set perm for ~/.ssh/config
$ chmod 644 ~/.ssh/config
2. Generate the rsa key
$ ssh-keygen -t rsa -b 2048 -C "${MY_EMAIL_ADDRESS}"
3. Add the new key to the ssh agent
$ ssh-add ~/.ssh/id_rsa_${MY_PRIVATE_KEY}
4. Set the configuration file for the gitlab host
$ cat ~/.ssh/config
Host gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_${PRIVATE_KEY}
User git
Ref: https://docs.gitlab.com/ee/ssh/#working-with-non-default-ssh-key-pair-paths
No comments:
Post a Comment