views:

238

answers:

3

i can't figure out how i should access the repository from a CakePHP project called fredistrano (you can do CakePHP deploys with a web 2.0 interface). i have fredistrano in my web broadcasting directory on a shared unix web server. when i use tortoisesvn from my laptop, i have to use svn+ssh://[email protected]/svnpath/trunk/. i tried using the same thing in fredistrano, but i keep getting the svn command error "svn: Network connection closed unexpectedly". i copied and pasted the command: svn export --non-interactive --username myusername --password mypwd svn+ssh://[email protected]/home/myusername/svn/mydomain.com/trunk tmpDir 2>&1 into my SSH terminal connected to the shared server and i get a prompt for a password, which i believe is actual a prompt for the SSH password and not the SVN password (see this post). fredistrano is failing because it can't deal w/ the SSH password prompt. i noticed in the fredistrano documentation that the example uses http://ipaddress/svn/test for the SVN URL. i copied my svn to my web broadcasting direrctory and tried this but get a connection refused error. my shared hosting provider is pretty strict and i doubt that i can use that. is there a way i can get svn+ssh to work w/ a PHP script like this (fredistrano is just using shell_exec() to execute svn commands)? is there a way i can get just get svn, http, or https working (or any other method that i don't know about)?

A: 

"svn: Network connection closed unexpectedly" most probably means that your host has restricted/forbidden access to other hosts. This might imply using sockets at all (SVN, HTTP, etc.) or maybe only non-HTTP. In this case you should try setting up your SVN server to allow HTTP requests (e.g. using mod_dav_svn for Apache).

This is only a guess - see my comment to your question.

Koraktor
like i said in the post, i'm pretty sure that this particular error is probably due to the PHP script not being able to handle the SSH password prompt that occurs after an svn command is run using svn+ssh (the error probably means that the attempt to connect timed-out or something). if you specify the --password mypwd switch for the svn command, this just covers the svn password, not the SSH password.
gabe
A: 

How do you authenticate from your dev machine to the svn-server? You might be using a key to authenticate (Do you have putty pageant running?)

troelskn
TortoiseSVN uses putty but i just enter the password when it prompts me. when i connect to the server directly w/ a putty terminal, i just enter my username and password.
gabe
Yes, but is that a password (eg. does it get sent to the server) or is it a passphrase (Eg. does it unlock the private key locally).
troelskn
i actually don't have any keys set-up. i have just have been using keyboard interactive. sorry about my ignorance if i'm missing something. still try to get better at this stuff.
gabe
You will probably get better help if you take this issue to a mailinglist (`[email protected]`), since it requires some debugging to find the source of the problem.
troelskn
+1  A: 

I am interested in this problem, too, and I hope that I'm close to the solution.

I haven't tried to put it into work in my application due to the lack of time and other high-priority tasks, but I guess that it should look something like this:

shell_exec(svn something svn+ssh://...)

$response = trim(fgets(STDIN))

[then check if the response contains password prompt text]

fwrite(STDOUT, 'yourpassword');

[analyze the next response and see if SVN has returned the requested information - log, info, whatever]

Oliver
looks interesting. i don't have time to try it out right either, but if you get it, then let me know if you have a chance.
gabe