-
ssh-keygenで公開鍵と秘密鍵を作る
ssh-keygen -t rsa -C "t.katou@gmail.com"
Generating public/private rsa key pair. Enter file in which to save the key (/home/.ssh/id_rsa): gitlab_id__rsa[Enter]#なんでも大丈夫だけど、あとで使います。 Enter passphrase (empty for no passphrase): ← [Enter]必要であれば入力 Enter same passphrase again: ← [Enter]必要であれば入力
-
公開鍵をgitlabに登録する
- gitlabのSettingsからSSH Keysを選び、以下のコマンドで公開鍵をコピーして、「key」欄にペーストして、「Add key」をクリック。「title」は変更しなくても大丈夫。
公開鍵のコピーpbcopy < ~/.ssh/id_rsa.pub
-
~/.ssh/configを編集する
~/.ssh/configHOST 10.10.10.10 user git HostName 10.10.10.10 identitiesonly yes identityFile ~/.ssh/gitlab_id_rsa
-
ssh接続を確認する
ssh -T gitlabのホスト名(アドレス) Welcomek to Gitlab, Taro Katou!
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme