Search code examples
gitbashgithubgit-bashgit-clone

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


I am following this MOOC to learn about Git. The first command I typed into Git Bash was git --version which gave me git version 2.8.3.windows.1.

Then I typed git clone https://github.com/udacity/asteroids.git in order to clone the repository. In the video lecture, the instructor's screen looks like this when they enter the command:

enter image description here

But in my Git Bash, I get the following output. As you can see in the start, the $ git clone appears twice, but I had entered the command only once. Besides, I don't see anything added to the directory where I had opened Git Bash.

How should I correct this problem?

$ 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

Solution

  • It seems to me that the output you got shows you the options from which you can choose an argument to supply to the command. Try using one of those arguments, like git clone https://github.com/udacity/asteroids.git --bare.

    I just tried git clone https://github.com/udacity/asteroids.git --bare and it worked for me. It cloned the repository and the output in Bash is much like the one you are expecting:

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

    EDIT:

    Sorry previously I did not try the simple command git clone https://github.com/udacity/asteroids.git. I tried it, and it also works for me.

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

    Please be careful and try again.