LoginSignup
7
4

More than 1 year has passed since last update.

【Git】fatal: detected dubious ownership in repository 解消法

Posted at

状況

git pullを実行した際に次のエラーが発生しました。

$ git pull origin main
fatal: detected dubious ownership in repository at '/workspaces'
To add an exception for this directory, call:

        git config --global --add safe.directory /workspaces

対処法

リポジトリのファイル等の所有者を変更する

次のコマンドを実行してリポジトリのファイル等の所有者を変更します。

sudo chown -R user /workspaces

safe.directoryに追加

上記を実行しても改善しない場合には次のコマンドを実行してsafe.directoryに追加します。

git config --global --add safe.directory /workspaces
7
4
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
7
4