How to get Git to clone into current directory
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.
The following is probably not fully equivalent to a clone in all cases but did the trick for me:
git init .
git remote add -t \* -f origin <repository-url>
git checkout master
In my case, this produces a .git/config
file which is equivalent to the one I get when doing a clone.
@Andrew has answered it clearly here. But as simple as this also works even if the directory is not empty:
git init .
git remote add origin <repository-url>
git pull origin master
Do
git clone https://[email protected]/user/projectname.git .
Directory must be empty