[Solved] ubuntu 20.04, git submodule update failed with 'fatal: detected dubious ownership in repository

Linux Mohit Mozumder

Problem:

Today I mounted a HDD in my Linux workstation then I tried to download a new repo in
the new disk so when I executed the command git submodule update --init --recursive suddenly the error happens-

fatal: detected dubious ownership in repository at '/media/data/users/jhu3szh/serialize'
To add an exception for this directory, call:

git config --global --add safe.directory /media/data/users/jhu3szh/serialize

 

Solution:

To solve the problem just change the ownership manually by the command-

chown -R <current_user> <repo_folder>

or ~

Just create a new directory on your disk where your current user is the owner of that new directory. Then in this new directory clone your git repo.


Thank you for reading the article. For any other query feel free to ask us.