Monthly Archives: July 2012

Accessing a remote svn repository on a non-standard port with Win7

Accessing a remote svn repository that provides SSH on a non-standard port with a Windows7 computer has its own special quirks you have to figure out. Here is how I figured it out.

Windows 7 users, how to use svn

Download & install Tortoise SVN http://tortoisesvn.net/downloads.html TortoiseSVN effectively installs subversion on your system, but you have to make some provisions when the host has installed ssh on a non-standard port, which is done sometimes for security reasons. So for this reason, we will use tortoisesvn for svn but you wont be interacting with it for this website. TortoiseSVN seems to have some kind of issue with connecting to non-standard ports for ssh, and this is really the problem that brought about this little exercise in the first place. So you install TortoiseSVN, but you will use a command line tool to work with subversion for this workaround, and this is explained further down the post. Next bit of housekeeping is specifying the port.

Specifying a port

  • We have to specify a port for the web host, because ssh is on a non-standard port, 10222, instead of 22.
  • In your home directory, locate the .ssh directory. You may need to change your folder settings to show hidden files.
  • create a file in this folder called config not config.txt, just config.
  • open and edit config
  • add the following lines and save:
    Host abcdefdomain.ca
    User abcdefuser
    Port 10222
  • save and exit that shit.

Dealing with a non-standard port

Because of the non-standard port, you will need to use git-bash
from the command line, using git-bash http://code.google.com/p/msysgit/
This software installs git on your system, but actually is a shell environment much like terminal in mac, or puttySSH, which allows you to navigate a windows system with bash commands like ls, pwd, rm, ping, cd, mkdir, and others. Also installs Vim. This app is very handy for us shell zealots when we have our hands on a windoze machien that we keep around for MS Project and Steam games.

Make a directory either in windows or git-bash. Use git-bash to get into that directory.
The command might look like this:

cd ~/websites/codebase/

Then from the command line, you enter the following command:

svn checkout svn+ssh://username@xyzabcdomain.com/home2/path/to/repository/dev3_repo/repo/trunk .

This command is all in one line. Note the local dot at the end! You wouldnt add that using TortoiseSVN.
You will be prompted twice for the password. Once for svn, once for ssh.
A big dump of text should follow on the screen if it was done correctly.

Checking in changes:

if you have made changes to a local file and wish to commit it to the repository, go to the command line with git-bash where the file is and enter the following command at the command line:

svn commit -m “MB line 43-44, changes to formatting xyz.php file” xyz.php

(all in one line).
You commit the file to the repository, with a message, in quotes, you add your initials so a reader can know it is you, you specify as well as possible the change you made, with line numbers, mention the file name in the message, and then the file name itself after the quotes.
hit return, and enter the password when prompted.

If you want to pull down any changes that have been made recently, go to the directory with the command line and do this:

svn up

OR

svn update

enter the password when prompted.

This post was created because dealing with a remote svn repository on a non-standard port using a windows7 machine has its own special, special problems.

But you are a Git user…. What about GIT ?

This blog post provides a workaround for a problem accessing a source over SSH when it is on a non standard port. I wouldnt be surprised if other clients have similar problems when attempting to connect remotely using a win7 desktop.

Acknowledgement goes out to:

Rick at http://conxentric.com/blog/ for this blog post comment:

http://www.techper.net/2009/01/11/changing-port-number-of-svnssh-subversion-protocol/#12