像git clone这样的Git命令在Git Bash中不起作用

时间:2016-05-31 19:30:53

标签: git bash github git-bash git-clone

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

然后我输入 git clone https://github.com/udacity/asteroids.git 以克隆存储库。在视频讲座中,教师的屏幕在输入命令时看起来像这样:

enter image description here

但在我的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

1 个答案:

答案 0 :(得分:4)

在我看来,你得到的输出显示了你可以从中选择一个参数来提供命令的选项。尝试使用其中一个参数,例如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.

请小心,然后重试。