Why does it say that error: unknown switch `t'?

96 views Asked by At

enter image description here

$ git clone -b master https://github.com/jerryc127/hexo -theme-butterfly .git themes/butterfly
error: unknown switch `t'
usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    --reject-shallow      don't clone shallow repository
    -n, --no-checkout     don't create a checkout
    --bare                create a bare repository
    --mirror              create a mirror repository (implies bare)
    -l, --local           to clone from a local repository
    --no-hardlinks        don't use local hardlinks, always copy
    -s, --shared          setup as shared repository
    --recurse-submodules[=<pathspec>]
                          initialize submodules in the clone
    --recursive[=<pathspec>]

I want to clone a hexo theme to me blog file

1

There are 1 answers

0
Kelsey On

This code should do what you are intending:

git clone -b master https://github.com/jerryc127/hexo themes/butterfly             

The reason why you're getting unknown switch 't' is because the git command line interface uses dashes to determine which arguments are being passed in.

"A double-dash is a syntax used in shell commands to signify end of command options and beginning of positional arguments. In other words, it separates command options from arguments that command operates on."

So git is getting to where you wrote -themes, but it sees the -t first and throws the error you're seeing because there's no space after -t.

Essentially, git does not see your -themes as an actual theme but rather an equivalent to "I have another thing to pass into the script"

More info here: https://www.tutorialspoint.com/what-does-a-double-dash-in-shell-commands-mean#:~:text=A%20double%2Ddash%20is%20a,that%20modify%20behavior%20of%20command.