2020年3月12日 星期四

gitlab SSH

Gitlab SSH

官方說明


//create ssh key
eg. rsa ssh key
ssh-keygen -t rsa -b 4096 -C "email@example.com"


//如果有多組 ssh key,可指定使用哪一組

寫入config檔
~/username/.ssh/config

//範例
# GitLab.com
Host gitlab.com
  Preferredauthentications publickey
  IdentityFile ~/.ssh/gitlab_com_rsa

# Private GitLab instance
Host gitlab.company.com
  Preferredauthentications publickey
  IdentityFile ~/.ssh/example_com_rsa

//測試
ssh -T git@gitlab.com

如果成功,會詢問是否把domain加到known_hosts

//刪除 known_hosts
所有的ssh 都會重新詢問一次


沒有留言:

張貼留言