0

I'm trying to do something very simple: Clone a repository.

The documentation here: http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository isn't particularly clear on the usage of the clone command.

I assumed you would run clone within an empty directory and it would pull all the files down as a new repository. However this doesn't seem to work as I expected:

I've done this:

mkdir newrepo
cd newrepo
git clone /repo/i/want/to/clone

It doesn't work, but the message I get is confusing: "Cloning into /repo/i/want/to/clone". Does this mean it's attempting to copy files from "newrepo" into /repo/i/want/to/clone?

From this perspective, the documentation and the message the command prints are contradictory.

tl;dr: Should clone be run from the existing repo passing it the URL of the repo I want the files copied to, or should it be run from an empty directory and passed the URL of the repo I want the files copied from?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Tom B
  • 2,735
  • 2
  • 24
  • 30

2 Answers2

1

You did it wrong. You forgot to specify protocol. The git clone go this way

$ git clone <url> [<folder>]

So if you want to clone from local folder you need to write:

$ git clone file:///repo/you/want/to/clone
Hauleth
  • 22,873
  • 4
  • 61
  • 112
0

You're doing it the correct way, git should clone the repository given in argument, into the current directory.

Error message is confusing, but it may be because the remote repository doesn't exist or doesn't have the good protocol handler (git://, file://, ssh:// or http://).

CharlesB
  • 86,532
  • 28
  • 194
  • 218
  • Thanks, I had been using ssh which worked. It was the wording that had confused me! I realise now, that it had created a directory in my cwd with the name of the repo I had cloned, not cloned the contents of the remote directory into the current directory. – Tom B Feb 11 '13 at 14:52