Category Archives: Subversion

Using subversion over ssh gate server

If you have the same problem like me, connecting to a svn server that is only reachable over a gate server, try this:

  • Add your root public ssh key to the ~/.ssh/authorized_keys on the gate server.
  • And your user public ssh key to the ~/.ssh/authorized_keys on the svn server.
  • Try this: ssh -L 24:<svn_server>:22 <gate_login>@<gate_server>
  • Now nmap should show something like this:
  • doep ~ # nmap localhost
    24/tcp    open  priv-mail
  • You can also create an init script. /etc/init.d/sshtun
  • #!/sbin/runscript
    SSHTUN_OPTIONS="-L 24:<svn_server>:22 <gate_login>@<gate_server> -N"
    depend() {
    need net
    start() {
    ebegin "Starting sshtun"
    start-stop-daemon --start --quiet --exec /usr/bin/ssh --background \
    --pidfile /var/run/ --make-pidfile -- $SSHTUN_OPTIONS
    eend $?
    stop() {
    ebegin "Stopping sshtun"
    start-stop-daemon --stop --quiet --pidfile /var/run/
    eend $?
  • Don’t forget to make it executable:
  • doep ~ # chmod +x /etc/init.d/sshtun
  • Then start the ssh tunnel:
  • doep ~ # /etc/init.d/sshtun start
  • To create the tunnel on startup, use rc-update:
  • doep ~ # rc-update add sshtun default
  • Now open your ssh config ~/.ssh/config and add a new server:
  • Host svn
    HostName localhost
    User <svn_user>
    Port 24
  • If you have already checked out a repository you can easily change the location:
  • doep@doep ~ $ svn switch --relocate http://<svn_server>/svn/repository svn+ssh://svn/var/svn/repos/repository
  • Otherwise check it out:
  • doep@doep ~ $ svn co svn+ssh://svn/var/svn/repos/repository
VN:F [1.9.22_1171]
Rating: 6.0/10 (3 votes cast)

Using subversion through a ssh tunnel with windows

  • Download and install the PuTTY from here
  • Download and install RapidSVN from here
  • Copy the plink.exe form the PuTTY folder to the RapidSVN/bin folder.
  • Generate a public/private key pair with PuTTYgen and save the two keys to any folder by pressing the ‘any key’.
  • Add the public key to your ~/.ssh/authorized_keys on the svn server. Maybe youe have to correct the format like “ssh-rsa <KEY> user@host“.
  • Create a new ssh session with PuTTY using the following option:
    • host = localhost
    • port = 24
    • connection/data/auto-login username = your username
    • connection/ssh/auth/private key file for authentication = path to your generated private key file
  • Then save this session under the name svn.
  • Generate a new session called tun with this options:
    • host = tunnel server
    • port = 22
    • connection/data/auto-login username = username for the tunnel server
    • in connection/ssh/tunnels/ add: L24 svnserver:22
  • Now tell RapidSVN how to deal with svn+ssh:// URLs:
    • Search your svn config file. For windows 7 its located here: C:\Users\username\AppData\Roaming\Subversion\
    • Open it and goto the [tunnels] section. Then add this line: ssh = $SVN_SSH “C:/Program Files (x86)/RapidSVN-0.10.0/bin/plink.exe”
  • If RapidSVN is already open, then restart it.
  • Start the tun session with PuTTY and login.
  • You can also start the svn session to see if the key auth works. If not, check the authorized_keys file on the svn server.
  • Now you can checkout your repo, with an URL like: svn+ssh://svn/absolute path to repo on svn server/. Here, the ‘svn’ stands for the PuTTY session name.
VN:F [1.9.22_1171]
Rating: 5.0/10 (3 votes cast)
Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.