LoginSignup
1
2

More than 5 years have passed since last update.

gitのsshの設定

Last updated at Posted at 2018-07-23

この記事を書いた経緯

研究室内でgitlabを使ってソースコードを管理しているが, HTTPで接続するといちいちログインパスを聞かれるので, ssh接続にして公開鍵認証でログインするようにした。

設定方法

計算機サーバーでの設定

# 公開鍵生成
ssh-keygen
# パスとパスフレーズ設定(デフォルトでもよい。セキュリティ的に良くないが)

# 公開鍵をコピーする
cat  ~/.ssh/id_rsa

# gitlabサーバーを公開鍵で接続するように設定
vim ~/.ssh/config
config
Host 10.228.155.190
User tsawa
IdentityFile ~/.ssh/id_rsa

gitlabでの設定

  1. ブラウザを使ってgitlabにアクセスする
  2. 任意のプロジェクトの設定をsshにする
  3. SetttingsのSSH Keysを開く
  4. Keyに公開鍵をペースト, Titleを入れてAdd Key

まとめ

これをすればクーロンしたときなんかもパスを聞かれないはず

1
2
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
1
2