为什么会说错误:未知开关`t'?

问题描述 投票:0回答:1

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>]

我想克隆一个 hexo 主题到我的博客文件

github switch-statement hexo
1个回答
0
投票

此代码应该可以实现您的预期:

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

您收到未知开关“t”的原因是因为 git 命令行界面使用破折号来确定传入的参数。

“双破折号是 shell 命令中使用的一种语法,用于表示命令选项的结束和位置参数的开始。换句话说,它将命令选项与命令操作的参数分开。”

所以 git 正在到达您编写 -themes 的位置,但它首先看到 -t 并抛出您所看到的错误,因为 -t 之后没有空格。

本质上,git 不会将你的 -themes 视为实际主题,而是相当于“我还有另一件事要传递到脚本中”

更多信息在这里: https://www.tutorialspoint.com/what-does-a-double-dash-in-shell-commands-mean#:~:text=A%20double%2Ddash%20is%20a,that%20modify%20behavior% 20of%20 命令.

© www.soinside.com 2019 - 2024. All rights reserved.