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?

link|improve this question
It looks like you have no write permissions inside the directory you are working in. – Sgaduuw Aug 2 '11 at 8:56
@Sgaduuw: No, this is not the problem. His syntax is wrong and git tries to create a repo somewhere. – SvenW Aug 2 '11 at 9:03
Yes the write permissions problem is because i didn't specify a local destination - that issue's gone, now on to new ones :) – harry83 Aug 2 '11 at 9:04
feedback

3 Answers

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

git clone ssh://root@serverIP/mysite/.git /home/user_name/mysite
link|improve this answer
feedback

You must give ssh the whole path to your repo and the.git part is unnecessary, git can figure that one out by itself:

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

Edited: When using the URL type ssh:// syntax, the colon I used earlier is not valid. There is another syntax (ssh style), which needs it:

 git clone root@serverIP:/home/mysite 

I usually prefer the second form.

link|improve this answer
thanks for the reply. I can connect ok now but when I try to clone to a local destination I get: warning: You appear to have cloned an empty repository. stdin: is not a tty – harry83 Aug 2 '11 at 9:20
feedback

A valid ssh URL should look like ssh://{user}@host.xz/path/to/repo.git, so you should be ok (if (mysite/.git is a valid path).

The issue should be on the local side: do you have write access to your current directory?


Once you have write access, you still have two messages:

  • stdin: is not a tty: that means something in your .bashrc or in the global .bashrc is waiting for an input: see ee for example:

There is a line (mesg y) inside the global bashrc file that will cause repeated messages when interacting with GIT (stdin: is not a tty)

That would not prevent a clone.

  • warning: You appear to have cloned an empty repository: that warning is independent from the previous message, and should be accurate if the repo you are cloning is, indeed, an empty one.
link|improve this answer
The write permissions issue is sorted, I wasn't specifying a local destination. I now get the error: warning: You appear to have cloned an empty repository. stdin: is not a tty – harry83 Aug 2 '11 at 9:06
@harry83: Have you added the /home part like I told you in my answer? SSH needs it, because it always start at the root directory. – SvenW Aug 2 '11 at 9:20
@SvenW - yes I have the same as you recommended, the full path containing /home/mysite – harry83 Aug 2 '11 at 9:28
@harry83: I have updated my answer. – VonC Aug 2 '11 at 10:46
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.