LoginSignup
1
0

More than 1 year has passed since last update.

IntelliJ で ssh による Git 操作ができるまで

Last updated at Posted at 2022-11-24

環境

  • Windows 10
  • IntelliJ IDEA Community Edition 2022.2.3

困ったこと

  • IntelliJ で GitHub からプロジェクトを Clone するのに手間取ったので備忘録
  • WSL (Windows Subsystem for Linux) では GitHub は普通に使えていた。

原因

  • WSL で参照する SSH 鍵と IntelliJ (Git Bash) で参照する SSH 鍵のフォルダが異なっていたため。

対処

下記に SSH キーペアの設定が WSL 環境で完了している場合、していない場合の対処を記載する。

共通

  1. Git アカウントを連携し、"Clone git repositories using ssh" を選択する
    https://pleiades.io/help/idea/github.html

  2. Git Bash (Git for Windows) をインストールする
    https://gitforwindows.org/

  3. IntelliJ からターミナル (alt + F12) を開き、Git Bash を起動する

WSL で設置済みの場合

  1. WSL のターミナルを開く
  2. 利用している秘密鍵を GitBash が参照する .ssh フォルダは以下に移動する
cp ~/.ssh/${secret_key} /mnrt/c/Users/${user_name}/.ssh 

WSL で未設定の場合

  1. SSHキーペアを作成する
    https://docs.github.com/ja/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

  2. GitHub に公開鍵を登録する
    https://docs.github.com/ja/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

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