Correct Git clone syntax for SSH

gitversion control

I'm trying to access a remote git repository using SSH but I'm getting a fatal error – is there a problem with my syntax?

I've created a git repo in the mysite folder on my server – so the repo is at /home/mysite/.git

git clone ssh://root@serverIP/mysite/.git
fatal: could not create work tree dir 'mysite'.: Permission denied

Can anyone see what is wrong with my syntax or is there another issue here?

Best Answer

Try to use full path for target directory. For exampple:

git clone ssh://root@serverIP/mysite/.git /home/user_name/mysite

UPD:

When git clones repo it creates directory for it based on repo's name.

git clone git@example.com:username/repo.git

Git will create directory repo. But there is NO repo name in your case mysite/.git.