Git命令如“git clone”在Git Bash中不工作

问题描述:

我在关注this MOOC以了解Git。我输入Git Bash的第一个命令是git --version它给了我git version 2.8.3.windows.1Git命令如“git clone”在Git Bash中不工作

然后我输入git clone https://github.com/udacity/asteroids.git为了克隆存储库。在视频讲座,讲师的屏幕看起来是这样的,当他们进入命令:

enter image description here

但在我的Git猛砸,我得到下面的输出。正如你在开始时看到的,$ 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 
+3

真的好像你没有运行'git clone https:// github.com/udacity/asteroids.git',而是'git clone $ git clone'?即使这只是一个显示问题,克隆URL仍然缺失。但是,然后git应该说“太少的论点”,而不是“太多”... –

+1

你是否也应付$? –

+1

“git clone $ git clone”这就是3参数,顺便说错了;-) – murraybo

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

我刚刚试过git clone https://github.com/udacity/asteroids.git --bare它对我有用。它克隆的资源库,并猛砸输出非常像你期望的一个:

$ 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. 

请小心,然后再试一次。