git clone without project folder

I have given access to server, and want to clone git repo into my root folder. But when I do git clone it will make me folder with project name, and my project folder is my root. I dont have access to my parent folder my root is

/var/www/sites/mysite/

and when I do cloning folder structure will be

/var/www/sites/mysite/mysite

git clone accepts a last argument that is the destination directory, it is by default the name of the project but you can change it. In your case you probably want simply .:

$ git clone origin-url .

But note that, from man git-clone:

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


You can also just setup a new repo and then the tracking remote and branch:

git init .
git remote add origin [email protected]:user/repo.git
git fetch origin
git checkout master