Project

General

Profile

Connecting to remote SVN repository via svn+ssh

Added by Bellatoris Opacus about 14 years ago

I'm trying to connect to a remote repository via svn+ssh. I've successfully created a private/public key and added the public key to the SVN server. The private key is on the Redmine server.

When I type svn list --xml 'svn+ssh://ssh_user@domain.org/path/to/my/repository' on the command line on the Redmine server it works fine and responds without asking for a password. However, Redmine can't seem to connect. I have tried putting svn+ssh://ssh_user@domain.org/path/to/my/repository into the URL field and leave the user id and password blank, as well as filling in the user id and password fields without success.

Can someone please let me know what I'm doing wrong? The only thing that I can think of is that maybe Redmine isn't using the proper key file? Why else would it work from the commandline but not from Redmine? Is it because of the user that Redmine is run under?

Thanks for any help!


Replies (15)

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

FYI I'm running Redmine 0.8.7.stable.3076 (MySQL)

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

Here's an excerpt from my production.log file:

Processing RepositoriesController#show (for 174.27.40.18 at 2009-12-28 20:04:18) [GET]
Session ID: cb2e4b1d1da8538741474b953ef3d6ec
Parameters: {"action"=>"show", "id"=>"******", "controller"=>"repositories"}
^[[4;36;1mSQL (0.000082)^[[0m ^[[0;1mSELECT max(`settings`.updated_on) AS max_updated_on FROM `settings` ^[[0m
^[[4;35;1mUser Load (0.000061)^[[0m ^[[0mSELECT * FROM `users` WHERE (`users`.`id` = 1) AND (users.status = 1) ^[[0m
^[[4;36;1mProject Load (0.000054)^[[0m ^[[0;1mSELECT * FROM `projects` WHERE (`projects`.`identifier` = '******') LIMIT 1^[[0m
^[[4;35;1mRepository Load (0.000049)^[[0m ^[[0mSELECT * FROM `repositories` WHERE (`repositories`.project_id = 1) LIMIT 1^[[0m
^[[4;36;1mEnabledModule Load (0.000057)^[[0m ^[[0;1mSELECT * FROM `enabled_modules` WHERE (`enabled_modules`.project_id = 1) ^[[0m
Shelling out: svn info --xml 'svn+ssh://*******.org/********/' --no-auth-cache --non-interactive
^[[4;35;1mSQL (0.000087)^[[0m ^[[0mBEGIN^[[0m
^[[4;36;1mSQL (0.000034)^[[0m ^[[0;1mCOMMIT^[[0m
Shelling out: svn info --xml 'svn+ssh://********.org/*******/' --no-auth-cache --non-interactive
^[[4;35;1mSQL (0.000076)^[[0m ^[[0mBEGIN^[[0m
^[[4;36;1mSQL (0.000035)^[[0m ^[[0;1mCOMMIT^[[0m
Shelling out: svn list --xml 'svn+ssh://*******.org/*******/'@HEAD --no-auth-cache --non-interactive
^[[4;35;1mChangeset Load (0.000108)^[[0m ^[[0mSELECT * FROM `changesets` WHERE (`changesets`.repository_id = 1) ORDER BY committed_on DESC, changesets.committed_on DESC, changesets.id DESC LIMIT 10^[[0m
Rendering template within layouts/base
^[[4;36;1mSQL (0.000120)^[[0m ^[[0;1mSELECT count(DISTINCT `members`.id) AS count_all FROM `members` LEFT OUTER JOIN `projects` ON `projects`.id = `members`.project_id LEFT OUTER JOIN `roles` ON `roles`.id = `members`.role_id WHERE (`members`.user_id = 1 AND (projects.status=1)) ^[[0m
^[[4;35;1mProject Load Including Associations (0.000098)^[[0m ^[[0mSELECT `projects`.`id` AS t0_r0, `projects`.`name` AS t0_r1, `projects`.`description` AS t0_r2, `projects`.`homepage` AS t0_r3, `projects`.`is_public` AS t0_r4, `projects`.`parent_id` AS t0_r5, `projects`.`projects_count` AS t0_r6, `projects`.`created_on` AS t0_r7, `projects`.`updated_on` AS t0_r8, `projects`.`identifier` AS t0_r9, `projects`.`status` AS t0_r10, `parents_projects`.`id` AS t1_r0, `parents_projects`.`name` AS t1_r1, `parents_projects`.`description` AS t1_r2, `parents_projects`.`homepage` AS t1_r3, `parents_projects`.`is_public` AS t1_r4, `parents_projects`.`parent_id` AS t1_r5, `parents_projects`.`projects_count` AS t1_r6, `parents_projects`.`created_on` AS t1_r7, `parents_projects`.`updated_on` AS t1_r8, `parents_projects`.`identifier` AS t1_r9, `parents_projects`.`status` AS t1_r10 FROM `projects` LEFT OUTER JOIN `projects` parents_projects ON `parents_projects`.id = `projects`.parent_id INNER JOIN members ON projects.id = members.project_id WHERE ((`members`.user_id = 1) AND ((projects.status=1))) ^[[0m
Rendered layouts/_project_selector (0.00212)
^[[4;36;1mSQL (0.000056)^[[0m ^[[0;1mSELECT count(*) AS count_all FROM `versions` WHERE (`versions`.project_id = 1) ^[[0m
^[[4;35;1mWiki Load (0.000059)^[[0m ^[[0mSELECT * FROM `wikis` WHERE (`wikis`.project_id = 1) LIMIT 1^[[0m
^[[4;36;1mSQL (0.000045)^[[0m ^[[0;1mSELECT count(*) AS count_all FROM `boards` WHERE (`boards`.project_id = 1) ^[[0m
Completed in 0.03446 (29 reqs/sec) | Rendering: 0.01035 (30%) | DB: 0.00102 (2%) | 500 Internal Server Error [http://pm.*******.com/repositories/show/*******]

(I've replaced identifying info with *)

It appears to be trying to connect with svn list --xml 'svn+ssh://*******.org/*******/'@HEAD --no-auth-cache --non-interactive which works from the commandline but in the end there's a 500 Internal Server Error. What could be the problem?

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

I apologize for the lack of formatting.

RE: Connecting to remote SVN repository via svn+ssh - Added by Nico Brenner about 14 years ago

Hi, I just went through quite a hassle to get Redmine working with svn+ssh. I kept getting a 500 Internal Server Error, checking the log I discovered a problem like this: http://www.redmine.org/issues/3929 with a "No close tag for /lists/list" message, nevertheless it didn't make any sense to me.

I was running Redmine behind Apache, according to the instructions here: http://www.redmine.org/wiki/redmine/HowTo_configure_Apache_to_run_Redmine. The problem with this was I couldn't see what was going on, so I switched to running it from the redmine dir using "ruby script/server -e production". Then I was able to see the problem was Redmine needed an additional password and it was asking for it on the console. Since of course I didn't want to or could enter the password each time, I did the following:

  • Edited lib/redmine/scm/adapters/subversion_adapter.rb line 228 and removed the "--no-auth-cache" option
  • Edited /etc/passwd to enable a shell for apache
  • Gave write permission to apache on /var/www (it's home dir according to /etc/passwd)
  • Checked out my svn project so subversion would cache the password
  • Set up password-less ssh login on the svn server with a public key for user apache (followed these instructions: http://blogs.translucentcode.org/mick/archives/000230.html)
  • Tested the password-less ssh login
  • Edited /etc/passwd to disable the shell for apache

Then everything worked fine. Now I'm having another problem with yum and some package dependencies to install mod_fastcgi, but that's another story. Hope this helps.

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

I'm still having this same problem. Nico, I removed the "--no-auth-cache" option but that didn't change anything. Anybody else have any ideas? I'm really scratching my head on this one!

RE: Connecting to remote SVN repository via svn+ssh - Added by Nico Brenner about 14 years ago

Just removing that option doesn't do much, actually, I'm not even sure if that option did anything at all for solving my problem. My main problem was that apache needed to authenticate to the svn server when doing any svn operations, and for that the solution was to setup password-less ssh authentication for the user account running the apache server (username apache in my case). All the steps I describe above are what I had to do to set that up.

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

I'm on a shared hosting service, Bluehost, so I don't know if I can alter that. Is there a way I can verify that I'm having the same problem you did? Here's my log output:

Processing RepositoriesController#show (for 132.178.130.219 at 2010-02-24 07:52:21) [GET]
  Session ID: 1b846ad06e78b8ee49896bca204d66cf
  Parameters: {"action"=>"show", "id"=>"project", "controller"=>"repositories"}
  SQL (0.000140)   SELECT max(`settings`.updated_on) AS max_updated_on FROM `settings` 
  User Load (0.000080)   SELECT * FROM `users` WHERE (`users`.`id` = 1) AND (users.status = 1) 
  Project Load (0.000068)   SELECT * FROM `projects` WHERE (`projects`.`identifier` = 'project') LIMIT 1
  Repository Load (0.000061)   SELECT * FROM `repositories` WHERE (`repositories`.project_id = 1) LIMIT 1
  EnabledModule Load (0.000069)   SELECT * FROM `enabled_modules` WHERE (`enabled_modules`.project_id = 1) 
  Setting Load (0.000103)   SELECT * FROM `settings` WHERE (`settings`.`name` = 'autofetch_changesets') LIMIT 1
Shelling out: svn info --xml 'svn+ssh://user@domain.org/project/' --non-interactive
  SQL (0.000096)   BEGIN
  SQL (0.000040)   COMMIT
Shelling out: svn info --xml 'svn+ssh://user@domain.org/project/' --non-interactive
  SQL (0.000116)   BEGIN
  SQL (0.000060)   COMMIT
Shelling out: svn list --xml 'svn+ssh://user@domain.org/project/'@HEAD --non-interactive
  Changeset Load (0.000107)   SELECT * FROM `changesets` WHERE (`changesets`.repository_id = 1) ORDER BY committed_on DESC, changesets.committed_on DESC, changesets.id DESC LIMIT 10
Rendering template within layouts/base
  SQL (0.000078)   SELECT count(DISTINCT `members`.id) AS count_all FROM `members` LEFT OUTER JOIN `projects` ON `projects`.id = `members`.project_id LEFT OUTER JOIN `roles` ON `roles`.id = `members`.role_id WHERE (`members`.user_id = 1 AND (projects.status=1)) 
  Project Load Including Associations (0.000069)   SELECT `projects`.`id` AS t0_r0, `projects`.`name` AS t0_r1, `projects`.`description` AS t0_r2, `projects`.`homepage` AS t0_r3, `projects`.`is_public` AS t0_r4, `projects`.`parent_id` AS t0_r5, `projects`.`projects_count` AS t0_r6, `projects`.`created_on` AS t0_r7, `projects`.`updated_on` AS t0_r8, `projects`.`identifier` AS t0_r9, `projects`.`status` AS t0_r10, `parents_projects`.`id` AS t1_r0, `parents_projects`.`name` AS t1_r1, `parents_projects`.`description` AS t1_r2, `parents_projects`.`homepage` AS t1_r3, `parents_projects`.`is_public` AS t1_r4, `parents_projects`.`parent_id` AS t1_r5, `parents_projects`.`projects_count` AS t1_r6, `parents_projects`.`created_on` AS t1_r7, `parents_projects`.`updated_on` AS t1_r8, `parents_projects`.`identifier` AS t1_r9, `parents_projects`.`status` AS t1_r10 FROM `projects` LEFT OUTER JOIN `projects` parents_projects ON `parents_projects`.id = `projects`.parent_id INNER JOIN members ON projects.id = members.project_id WHERE ((`members`.user_id = 1) AND ((projects.status=1))) 
Rendered layouts/_project_selector (0.00160)
  SQL (0.000056)   SELECT count(*) AS count_all FROM `versions` WHERE (`versions`.project_id = 1) 
  Wiki Load (0.000055)   SELECT * FROM `wikis` WHERE (`wikis`.project_id = 1) LIMIT 1
  SQL (0.000051)   SELECT count(*) AS count_all FROM `boards` WHERE (`boards`.project_id = 1) 
Completed in 0.05550 (18 reqs/sec) | Rendering: 0.00969 (17%) | DB: 0.00125 (2%) | 500 Internal Server Error [http://pm.domain.com/repositories/show/project]

I'm not seeing anywhere where it might be asking for another password.

RE: Connecting to remote SVN repository via svn+ssh - Added by Nico Brenner about 14 years ago

I remember I wouldn't see it in the log, but if I didn't send redmine to the background (just running ruby script/server) and kept the console open, I would get the password prompt. I have no idea how you could solve this with a hosting service, since for what I did I needed access to the /etc/passwd file, maybe it is easier for you to change your repository. You wouldn't have this problem if your repository had an http interface (usually configured with Apache), and you used that instead of svn+ssh.

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

Alrighty, thanks for your help, Nico. There's got to be another solution. I'll keep looking.

RE: Connecting to remote SVN repository via svn+ssh = 500 Internal Server Error - Added by Bellatoris Opacus about 14 years ago

So, I'd greatly appreciate it if anyone else would weigh in here with their ideas. Here's my environment setup:

Ruby version              1.8.6 (x86_64-linux)
RubyGems version          1.3.5
Rails version             2.1.2
Active Record version     2.1.2
Action Pack version       2.1.2
Active Resource version   2.1.2
Action Mailer version     2.1.2
Active Support version    2.1.2
Edge Rails revision       unknown
Application root          /home3/greenin1/public_html/sarsendevelopment/pm
Environment               production
Database adapter          mysql

About your Redmine plugins
Mylyn connector plugin   v2.5
Stuff To Do Plugin       0.3.0

I think the former posts pretty clearly outline the problem I'm having so I won't reiterate it, but this is going beyond frustrating!

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

Just upgraded (Redmine 0.9.2.stable.3480 (MySQL)) but am having the same issue:

Ruby version              1.8.6 (x86_64-linux)
RubyGems version          1.3.5
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Application root          /home3/greenin1/public_html/sarsendevelopment/pm
Environment               development
Database adapter          mysql
Database schema version   20091227112908

About your Redmine plugins
Mylyn connector plugin   v2.5

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

I don't know if this helps at all, but I just ran the command from the ruby console and it worked fine. Here's the output:

>> system("svn list --xml 'svn+ssh://**********@**********.org/**********/'@HEAD --no-auth-cache --non-interactive")
<?xml version="1.0"?>
<lists>
<list
   path="svn+ssh://**********@**********.org/**********">
<entry
   kind="dir">
<name>branches</name>
<commit
   revision="1">
<author>**********</author>
<date>2009-11-17T22:32:19.098967Z</date>
</commit>
</entry>
<entry
   kind="dir">
<name>tags</name>
<commit
   revision="3">
<author>**********</author>
<date>2010-01-11T22:06:12.815654Z</date>
</commit>
</entry>
<entry
   kind="dir">
<name>trunk</name>
<commit
   revision="1">
<author>**********</author>
<date>2009-11-17T22:32:19.098967Z</date>
</commit>
</entry>
</list>
</lists>
=> true

RE: Connecting to remote SVN repository via svn+ssh - Added by Ki Won Kim about 14 years ago

see also Redmine FAQ
"I can't browse my svn repository through redmine" section
http://www.redmine.org/wiki/redmine/FAQ#I-cant-browse-my-svn-repository-through-redmine

modify subversion_adapter.rb in <redmine root>/lib/redmine/scm/adapters/subversion_adapter.rb
in credentials_string definition section chagne svn globaly options
from

--no-auth-cache --non-interactive

to

--trust-server-cert --no-auth-cache --non-interactive

RE: Connecting to remote SVN repository via svn+ssh - Added by Bellatoris Opacus about 14 years ago

Thanks for the reply, but the FAQ isn't applicable to this situation. It's talking about HTTPS access and I'm attempting to use SSH.

Still looking for solution to this. Does anyone else have this working?

RE: Connecting to remote SVN repository via svn+ssh SOLVED! - Added by Bellatoris Opacus about 14 years ago

Woot!

Finally got this working. I found an old post here (http://www.redmine.org/boards/2/topics/1325#message-3928) that fixed it for me.

Basically, even though svn was in my path, Redmine wasn't finding it. After I upgraded I found a new log file (at least, I don't remember seeing it there before) called scm.stderror.log in which were a bunch of lines saying

sh: svn: command not found
sh: svn: command not found
sh: svn: command not found
sh: svn: command not found
sh: svn: command not found

So I searched for the problem here in the forums, found the above mentioned post, modified the specified adapter and bada-boom, bada-bing.

Oh, the first time I accessed the repository the page rendering timed out, presumably because it was loading all the repository info into the database.

I hope this helps someone out.

    (1-15/15)