How to get Git to clone into current directory

MEM picture MEM · Mar 26, 2012 · Viewed 502.6k times · Source

I'm doing:

git clone ssh://[email protected]/home/user/private/repos/project_hub.git ./

I'm getting:

Fatal: destination path '.' already exists and is not an empty directory.

I know path . already exists. And I can assure that directory IS empty. (I do ls inside and I see nothing!)

What am I missing here in order to clone that project into the current directory ?

Answer

Roshan Pal picture Roshan Pal · Oct 8, 2013

simply put a dot next to it

git clone [email protected]:user/my-project.git .

From git help clone:

Cloning into an existing directory is only allowed if the directory is empty.

So make sure the directory is empty (check with ls -a), otherwise the command will fail.