Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

empty string is not a valid pathspec

Tags:

git

git-bash

After reading Git - git-submodule Documentation, I decided to import two files from my previous project into the root directory of my new project, because I don't want to manually synchronize these two files. However, an error occurs when I executed the following command:

$ git submodule add -b master -f --name latexci -- \
    https://github.com/donizyo/LaTeX-Travis.git .
fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths
usage: git submodule--helper clone [--prefix=<path>] [--quiet] [--reference <repository>] [--name <name>] [--depth <depth>] --url <url> --path <path>

    --prefix <path>       alternative anchor for relative paths
    --path <path>         where the new submodule will be cloned to
    --name <string>       name of the new submodule
    --url <string>        url where to clone the submodule from
    --reference <repo>    reference repository
    --dissociate          use --reference only while cloning
    --depth <string>      depth for shallow clones
    -q, --quiet           Suppress output for cloning a submodule
    --progress            force cloning progress

I'm using Git Bash 2.19.1.windows.1 to execute git commands.

like image 672
KaiserKatze Avatar asked Sep 14 '25 11:09

KaiserKatze


1 Answers

The path (.) should be a non-existent folder, like Latex-Travis.

Instead, here '.' is interpreted as an empty path (since it is refereing to your parent repo), and as illustrated in ruby-git/ruby-git issue 345:

This really was deprecated since Git 2.1.6:

An empty string as a pathspec element that means "everything" i.e. 'git add ""', is now illegal. We started this by first deprecating and warning a pathspec that has such an element in 2.11 (Nov 2016).

I am not aware of a submodule added directly within a parent repo folder: I always used to add as a parent repo subfolder.

like image 169
VonC Avatar answered Sep 16 '25 01:09

VonC