4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitlabでssh接続をする方法

Posted at
  1. 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]必要であれば入力
  1. 公開鍵をgitlabに登録する

    • gitlabのSettingsからSSH Keysを選び、以下のコマンドで公開鍵をコピーして、「key」欄にペーストして、「Add key」をクリック。「title」は変更しなくても大丈夫。
    公開鍵のコピー

pbcopy < ~/.ssh/id_rsa.pub


1. ~/.ssh/configを編集する

	```shell:~/.ssh/config
HOST 10.10.10.10
user git
HostName 10.10.10.10
identitiesonly yes
identityFile ~/.ssh/gitlab_id_rsa
  1. ssh接続を確認する

ssh -T gitlabのホスト名(アドレス)
Welcomek to Gitlab, Taro Katou!


4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?