How to get Git to clone into current directory

742    Asked by Aashishchaursiya in SQL Server , Asked on Jul 6, 2021

I'm doing:

git clone ssh://user@host.com/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 you that the 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?

Answered by yash Jaiteley

To solve git clone to current directory the solution is, simply add dot next to it:

    git clone git@github.com:user/my-project.git .

Even then the error doesn’t resolve to make sure that the directory is empty if you are not sure about your directory then run the above command with:

    rm -rf .* && git clone ssh://user@host.com/home/user/private/repos/project_hub.git .

This will remove the files present in the directory and then it works.



Your Answer

Interviews

Parent Categories