2016-05-31 121 views
-1

我在關注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

回答

4

在我看來,你有輸出顯示您可以從中選擇提供給命令的參數選項。嘗試使用其中一個參數,如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. 

請小心,然後再試一次。