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?

WSL2ユーザーでsudoを入れないとgitコマンドが使えない場合の対応

0
Posted at

概要

  WSL2環境下で権限設定が外れる手順をしていても、~/配下で新しくフォルダを用意して、git操作を始めようとしたところ毎回WSL2ユーザーでsudoコマンドを要求される事象がありました。この問題により、git push originコマンドが扱えない問題が発生したため、今回はその対応策となります。

手順

WSLの設定ファイルを更新する

# rootユーザーで設定ファイルを展開
sudo nano /etc/wsl.conf

ファイル末尾に以下設定を追記する

[automount]
options = "metadata,uid=1000,gid=1000"

上記追加して、上書き保存し閉じてください。

ファイル権限設定変更手順されてなければ、こちらも実施してください
https://qiita.com/Noripy/items/71c64af4a498a80622c0

設定ファイル適用するため再起動する

wsl --shutdown

確実に行いたい場合は、Windows OSの再起動をされることをオススメします

まとめ

本件も、windowsとLinuxのフォルダ構成・権限設定が対応しておらずの問題でした。
wsl.confに追記することで、その対応付けするものと考えております。

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?