0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Visual Studio Code + WSLプラグインを使用してage鍵を取得する

Last updated at Posted at 2025-11-01

Windows10にてWSLをインストールしようとしたが、

例: Ubuntu をインストール

wsl --install -d Ubuntu


wsl -l -v
Linux 用 Windows サブシステムにインストールされているディストリビューションはありません。
この問題を解決するには、以下の手順に従ってディストリビューションをインストールしてください:

'wsl.exe --list --online' を使用して利用可能な配布を一覧表示する
および 'wsl.exe --install <Distro>' を使用してインストールしてください。

のエラーが表示され、インストールできない。

代わりに、VScodeのWSLプラグインを使用する

WSLを起動

インストールできたら、ターミナルで

wsl -d Ubuntu

でwslを起動する

age 鍵ペアを生成して、秘密鍵を GitHub Secrets(SOPS_AGE_PRIVATE_KEY)に登録、公開鍵で secrets を暗号化する流れです。WSL(Linux)と Windows(PowerShell)両方のコマンドを示します。秘密鍵は絶対に公開しないでください。

WSL / Linux

Windows (PowerShell) — age バイナリを使う場合

WSL のホームで実行

kdir -p ~/.config/sops/age
age-keygen -o ~/.config/sops/age/keys.txt
age-keygen -y ~/.config/sops/age/keys.txt > ~/.config/sops/age/pub.txt
chmod 600 ~/.config/sops/age/keys.txt

確認・コピー用

cat ~/.config/sops/age/keys.txt    # -> GitHub Secrets に貼る (SOPS_AGE_PRIVATE_KEY)
cat ~/.config/sops/age/pub.txt     # -> 公開鍵(暗号化に使用)

wslのインストールが成功した場合

なお、WindowsでVScodeプラグインではないwslのインストールが上手くいくと、下記の画像のように表示される
wsl.jpg

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?