Git 类似 "git clone" 的命令在 Git Bash 中不起作用

Git commands like "git clone" are not working in Git Bash

我正在关注 this MOOC 以了解 Git。我输入 Git Bash 的第一个命令是 git --version ,它给了我 git version 2.8.3.windows.1 .

然后我输入 git clone https://github.com/udacity/asteroids.git 以克隆存储库。在视频讲座中,讲师输入命令时的屏幕如下所示:

但是在我的 Git Bash 中,我得到以下输出。正如您在开头看到的那样,$ git clone 出现了两次,但我只输入了一次命令。此外,我没有看到任何内容添加到我打开的目录 Git Bash.

我该如何解决这个问题?

$ git clone $ git clone
Too many arguments.

usage: git clone [<options>] [--] <repo> [<dir>]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet
    --progress            force progress reporting
    -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
    --recursive           initialize submodules in the clone
    --recurse-submodules  initialize submodules in the clone
    --template <template-directory>
                          directory from which templates will be used
    --reference <repo>    reference repository
    --dissociate          use --reference only while cloning
    -o, --origin <name>   use <name> instead of 'origin' to track upstream
    -b, --branch <branch>
                          checkout <branch> instead of the remote's HEAD
    -u, --upload-pack <path>
                          path to git-upload-pack on the remote
    --depth <depth>       create a shallow clone of that depth
    --single-branch       clone only one branch, HEAD or --branch
    --separate-git-dir <gitdir>
                          separate git dir from working tree
    -c, --config <key=value>
                          set config inside the new repository
    -4, --ipv4            use IPv4 addresses only
    -6, --ipv6            use IPv6 addresses only

在我看来,你得到的输出显示了选项,你可以从中选择一个参数来提供给命令。尝试使用其中一个参数,例如 git clone https://github.com/udacity/asteroids.git --bare.

我刚刚尝试了 git clone https://github.com/udacity/asteroids.git --bare,它对我有用。它克隆了存储库,Bash 中的输出与您期望的非常相似:

$ git clone https://github.com/udacity/asteroids.git --bare
Cloning into bare repository 'asteroids.git'...
remote: Counting objects: 209, done.
remote: Total 209 (delta 0), reused 0 (delta 0), pack-reused 209
Receiving objects: 100% (209/209), 184.61 KiB | 99.00 KiB/s, done.
Resolving deltas: 100% (128/128), done.
Checking connectivity... done.

编辑:

抱歉之前我没有尝试简单的命令git clone https://github.com/udacity/asteroids.git。我试过了,它也对我有用。

$ git clone https://github.com/udacity/asteroids.git
Cloning into 'asteroids'...
remote: Counting objects: 209, done.
remote: Total 209 (delta 0), reused 0 (delta 0), pack-reused 209
Receiving objects: 100% (209/209), 184.61 KiB | 154.00 KiB/s, done.
Resolving deltas: 100% (128/128), done.
Checking connectivity... done.

请注意重试