I want local test git submodule capability... I have two repositories in my folder. How to add bar repo as submodule for foo.
While my test I got
git submodule add --branch main /tmp/bar the_bar
fatal: transport 'file' not allowed
This solution works in git 2.48.1 (Ubuntu 25). Allow transport 'file' in your system
git config --global protocol.file.allow always # this is solution
Then you can use git as usual
mkdir -p /tmp/foo
mkdir -p /tmp/bar
cd /tmp/bar
git init .
touch hi
git add hi
git commit -m "Init"
cd /tmp/foo
git init .
touch bye
git add bye
git commit -m "Initial"
git submodule add --branch main /tmp/bar the_bar
You can check that submodule exists
git submodule status
766ac1ffc9a3252b85c9f6094f6d944f9f8d3f8a the_bar (heads/main)
If you don't want changing global git setting, you can add submodule with option
git -c protocol.file.allow=always submodule add --branch main /tmp/bar the_bar
Thanks to topic.