LoginSignup
0
1

More than 3 years have passed since last update.

秘密鍵接続を使ってWindowsのGit Bashでcloneする【conoha ssh】

Last updated at Posted at 2019-07-31

前提

  1. WindowsにGitとGit bashがインストールされていること。
  2. conohaにLinuxサーバを立てていること。
  3. Linuxサーバにgitがインストールされており、アクセス可能な場所にリポジトリがあること。

手順

  1. conohaの管理ページにログインする。
  2. conohaの管理ページからsshポートを開放する。
  3. conohaのゲストOS側のsshポートを開放する(firewall-cmdなどを使う)。
  4. conohaで公開鍵(パブリックキー)を作成する。同時に作成される秘密鍵をダウンロードしておく。
  5. conohaのゲストOSにログインする。gitリポジトリにログインするユーザの~/.ssh/authorized_keysを vi などで開き、先ほどconohaで作成したパブリックキーの長い文字列を転記する。
  6. conohaのゲストOSの設定ファイルを管理者権限(sudoなど)で編集する。
    これでルートログインとパスワード入力を不可にする。

    /etc/ssh/sshd_config
    #PermitRootLogim yes
    PermitRootLogim no
    #PasswordAuthentication yes
    PasswordAuthentication no
    
  7. sshd を再起動し、設定を有効にする。

    sudo systemctl restart sshd
    
  8. conohaからダウンロードした秘密鍵ファイルを、WindowsのC:\Users\<ユーザ名>\.ssh\id_rsaファイルとして名前変更し、移動する。

以上の手続きでGit Bashからgit cloneできました。
PuTTYのplink.exeを使おうとしてハマった…

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