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://username@domain.com/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://myusername@mydomain.com/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)?

Community
  • 1
  • 1
gabe
  • 1,873
  • 2
  • 20
  • 36
  • You should be more specific about your environment. Where did you run your code / your SSH commands? Your laptop, a dedicated server or whatever? – Koraktor Sep 23 '09 at 14:16
  • thx for the clarification questions. i added some more details. – gabe Sep 23 '09 at 14:25

4 Answers4

1

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 Maksimovic
  • 3,204
  • 3
  • 28
  • 44
  • 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 Nov 06 '09 at 16:25
0

"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
  • 41,357
  • 10
  • 69
  • 99
  • 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 Sep 23 '09 at 14:29
0

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
  • 115,121
  • 27
  • 131
  • 155
  • 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 Sep 23 '09 at 15:02
  • 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 Sep 23 '09 at 15:05
  • 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 Sep 23 '09 at 15:51
  • You will probably get better help if you take this issue to a mailinglist (`users@subversion.tigris.org`), since it requires some debugging to find the source of the problem. – troelskn Sep 23 '09 at 18:58
0

maybe check out the Subversion PHP Module (1.0.3) instead of wrapping shell_exec; it requires building from source, with phpize, ./configure and make (just built it against PHP 5.6 and Subversion 1.9.5)... while the Apache Module mod_dav (Subversion via HTTP/HTTPS) is not required for version control, rather an optional method of accessing the repository.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216