ERROR: GitError(Code:ERROR, Class:Submodule, cannot get submodules without a working tree)

Hello,

I would like to add one of my package AdaptiveTransportMap to a project but I get the following error message:

(NlVortexAssim) pkg> add AdaptiveTransportMap/
   Updating git-repo `/media/mat/HDD/AdaptiveTransportMap`
ERROR: GitError(Code:ERROR, Class:Submodule, cannot get submodules without a working tree)
Stacktrace:
 [1] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LibGit2/src/error.jl:106 [inlined]
 [2] checkout_tree(::LibGit2.GitRepo, ::LibGit2.GitTree; options::LibGit2.CheckoutOptions) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LibGit2/src/repository.jl:358
 [3] checkout_tree_to_path(::LibGit2.GitRepo, ::LibGit2.GitTree, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/GitTools.jl:122
 [4] (::Pkg.Types.var"#49#50"{Pkg.Types.Context,Pkg.Types.PackageSpec})(::LibGit2.GitRepo) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:644
 [5] with(::Pkg.Types.var"#49#50"{Pkg.Types.Context,Pkg.Types.PackageSpec}, ::LibGit2.GitRepo) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/LibGit2/src/types.jl:1128
 [6] handle_repo_add!(::Pkg.Types.Context, ::Pkg.Types.PackageSpec) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:597
 [7] handle_repos_add!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:663
 [8] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:169
 [9] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:140
 [10] #add#21 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:67 [inlined]
 [11] add(::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:67
 [12] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:404
 [13] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:382
 [14] do_cmd at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:377 [inlined]
 [15] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:546
 [16] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [17] invokelatest at ./essentials.jl:709 [inlined]
 [18] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
 [19] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1143
 [20] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at ./task.jl:356

Are you using submodules in your repository? It may be that they’re not supported. ~~~If so, it would probably make sense to open an issue: https://github.com/JuliaLang/julia/issues~~~

Ah, nevermind, it’s a known issue: https://github.com/JuliaLang/Pkg.jl/issues/708

1 Like

I saw this thread but I don’t understand what is the fix. There is no submodules in the package, scripts are just organized in different folders.

It’s hard to say without seeing the repository. You can check for submodules by running git submodule status.

If you have the repository already checked out, it might be easier to just ]dev [path] instead.

1 Like

The command git submodule status in the folder of the package to add returns:
fatal: no submodule mapping found in .gitmodules for path 'adaptivetransportmaps

Sorry, I am still in the learning curve of package management in Julia, what is the difference between ] add and ] dev?

It’s a bit subtle, but ] dev will point to another package as it currently exists on your disk (so can be modified), whereas ] add will point to a snapshot (e.g. a git hash).

2 Likes