LoginSignup
4
3

More than 3 years have passed since last update.

VSCode Remote Containerでコンテナからgitにssh接続する

Posted at

VScode Remote Containerを使って、dockerコンテナをローカルで編集できるようにしたが、gitへの接続で少しつまづいたしまったのでメモ。

ローカルのssh keyを利用して、git接続する方法

.devcontainer/docker-compose.ymlに下記を追記する

.devcontainer/docker-compose.yml
 volumes:
      - .:/workspace:cached
      - ~/.ssh:/root/.ssh #sshキー
      - ~/.gitconfig:/root/.gitconfig #gitの設定

これで、ローカルのssh keyをコンテナ内でも利用することができる。

4
3
1

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