The idea is handle the clone pre to the git submodule add
submodule_path=<dir>
submodule_clone_url=<url>
submodule_relative_url=<rel_path>
git clone --depth 1 --separate-git-dir=./.git/modules/${submodule_path} ${submodule_remote_url} ${submodule_path}
git submodule add ${submodule_relative_url} ${submodule_path}
The diff looks like this afterwards
cschneider@CPHAPF22MBP6:~/airoha/sdk_airoha(master)$ git diff --cached
diff --git a/.gitmodules b/.gitmodules
index 9ff939daf..83fc68eb6 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -24,3 +24,6 @@
+[submodule "${submodule_path} "]
+ path = ${submodule_path}
+ url = ${submodule_relative_url}
diff --git a/${submodule_path} b/s${submodule_path}
new file mode 160000
index 000000000..ce9bfc428
--- /dev/null
+++ b/${submodule_path}
@@ -0,0 +1 @@
+Subproject commit ce9bfc4285653eb04188b30fb67c60eab84a3ed6
You can now go to the submodule and find the artifact to add ..
git artifact fetch-co-latest -r <pattern>
The actual commit/tag/artifact can then be added/downloaded and committed.