问题
I had an svn repository that I used to checkout with the svn+ssh protocol. It has some EXTERNALS in it that refer to itself with the svn+ssh URL.
I was off this project for a while until today. When I try to access the svn+ssh url (that used to work some months ago) I get the message svn: No repository found in 'svn+ssh://my-correct.hostname.com/the/right/path/to/the/repository
. I double checked, and both the path and the hostname are correct.
I tried to check it out on the machine hosting the repo using a file://
URL, and it succeeded until it had to checkout the EXTERNALS, where it failed with the No repository
message. I used the same user locally and remotely.
Where should I look for logs/debug information to solve this issue?
回答1:
Thanks for introducing me to strace. I used strace to debug why the command:
svn+ssh://HOSTNAME/path/to/svn/directory
will not recognize this line in ~/.ssh/config:
Host HOSTNAME
To use strace, in the [tunnels] section of ~/.subversion/config. I changed this:
ssh = ssh -o ControlMaster=no
to this:
ssh = strace -o tmp ssh -o ControlMaster=no
Then I ran this command:
svn list svn+ssh://HOSTNAME/path/to/svn/directory
Looking at the output of strace that went into file "tmp" I could see that "HOSTNAME" was passed to the ssh command as "hostname". The quick fix was to change this line in ~/.ssh/config:
Host HOSTNAME
to this:
Host HOSTNAME hostname
Which causes the host specific settings to be applied whether the name of the host is passed to ssh as "HOSTNAME" or "hostname".
回答2:
I don't know where you can find the logs but I think you could remove/change the the externals property in that directory with this command:
svn propedit svn:externals path/to/dir
see: http://svnbook.red-bean.com/en/1.0/ch07s03.html
回答3:
I found my way through. I'm writing it here for future reference.
EDIT: It turns out a fellow colleague modified that file without notifying. Yet finding the cause of the problem was more difficult than ideal.
Long story short: even if I used the url svn+ssh://my-correct.hostname.com/the/right/path/to/the/repository
the real path looked up on the server was /var/svn/the/right/path/to/the/repository
. A wrong path indeed. But I think that the steps I did to find this might be useful to others, so I'll report them here.
First I moved (on the server) /usr/bin/svnserve to /usr/bin/svnserve.orig and put my own svnserve with these contents:
#!/bin/bash
strace -o /tmp/svntrace /usr/bin/svnserve.orig $@ | tee /tmp/svnserve-out
Then I run my checkout again, and after that /tmp/svntrace
on the server had in its tail all the info I needed to troubleshoot the problem.
It seems that in the file /var/svn/svnwrapper.sh
a new root for svn was set with the -r
option. After removing that all worked like a charm.
I still can't understand what happened (it used to work in the past and I'm almost sure I didn't change anything).
回答4:
strace helped isolate the issue. My repository was located at /var/svn/repos but the trace showed that it failed to find /repos/format. I added a symbolic link at /repos pointing to /var/svn/repos and it started working again.
来源:https://stackoverflow.com/questions/5298237/svn-repository-stopped-working-with-svnssh-but-works-locally-on-the-server