OK. So for most of you this is old hat. But still. I ran into some caveats, and wanna make this super simple.
Installing SVN on Win XP.
To start off, I want SVN as a service. Second, I want to use Tortise SVN as my client.
- Download SVN binaries for windows. Currently it is v1.4.5
- Install. This will automatically add the subversion binaries to your PATH.
- Add a new Environment Variable under System Variables (My Computer > Properties > Advanced > Environment Variables) called SVN_EDITOR and it is a path to some generic text editor (eg. c:\windows\notepad.exe)
- Create your repository in Command Prompt by this command (replacing the location with whatever you want)
svnadmin create "c:\Justin\Subversion Repository"
- Goto that folder and edit the /conf/svnserve.conf file. You want to uncomment the following: (Note: no spaces before the entries)
anon-access = read
auth-access = write
password-db = passwd
- Open the password conf file /conf/passwd and add a user/password in the format
user = password
- Start the SVN server in a Command Prompt to test it
svnserve --daemon --root "C:\Justin\Subversion Repository"
- This will stay open. So, open another Command Prompt window , and make a project in subversion
svn mkdir svn://localhost/myproject
- Now Notepad will start asking for a commit comment. Add whatever you want before the comment line (the one starting with “– This line …”), save and exit.
- Your command prompt will prompt you (it does that) for a user/pass. Funny that. Enter those from before.
- Now if you don’t want SVN as a service, and would rather start it up manually via the daemon command in Step 7, then you can skip this step. Otherwise, you’ll want to use this command in a prompt (after closing the currently running daemon prompt from Step 7)
sc create "Subversion Service" binpath= "\"c:\program files\subversion\bin\svnserve.exe\" --service --root \"c:\justin\subversion repository\" " displayname= "Subversion Repository" depend= Tcpip start= auto
You’ll note that you can remove the start= auto command if you want the service start as manual (read Reference 2 below for more info)
- Now, if you’d rather not use the command-line and notepad to do your commits, download and install TortiseSVN. Apparently don’t need to restart your system. I’m not sure myself. TortisSVN client is accessed by right-clicking files in Windows Explorer.
- If you’re like me, you’ve already got code to enter into Subversion. So what I do, is to Import the code (right click the folder you want to import, goto TortiseSVN and then import). You enter the URL of your repository as svn://localhost/myproject or whatever project you want really. Note: If installing SVN onto a server, just use that IP instead of localhost, though you’ll need to modify firewall settings on that machine to allow SVN access. (TCP port 3690 i believe)
- Then you need to check this folder out to some location. Either start in another fresh place, or delete your source files from their original location, and check out back into that folder. Yes, I said you can delete your source files (cause they are now stored in SVN) – though I’d bacup first obviously. To checkout, you’ll see the option in the direct right-click menu.
- Personally, at this point, I’d prefer to browse my repository, keeping only the files within that project that i need (for example, removing any unnecessary .NET files, like app_offline.htm, etc).
- Booyah. You’re done. When you start the day, you’ll likely Update your checkout location with the most recent files (obviously if others are working on your files).
- I’ll update this with an option to deploy to a network soon. (essentially it involves how you create the service
- The usual deal – use Update to update your source files with any changes in the repository (when working on the project with others). Use Commit to commit your changes to the repository. If anyone else made changes since your last update, you’ll get the differences window and have to decide on a course of action…
- Good luck.