`
hupy
  • 浏览: 186689 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Windows下安装subversion

阅读更多

前几天装SubVersion,在google上搜了一把,按国内的帖子的步骤,总报SVN_EDITOR找不到的错,无奈只好放下了。今天硬着头皮看了下老外写的安装指南,一下搞定,原来前几天搜的帖子少了增加SVN_EDITOR为环境变量的步骤。今天把老外的帖子转到这来。

  1. Download everything
    1. Go to http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91 and download the most recent svn-x.y.z-setup.exe. At the time of this writing, the latest version was svn-1.4.4-setup.exe. 我安装的时候只用了1.4.4下面的软件都没装。
    2. Go to http://dark.clansoft.dk/~mbn/svnservice/ and download SVNService.zip.
    3. Go to http://tortoisesvn.tigris.org/download.html and download the most recent installer. At the time of this writing, the latest version was TortoiseSVN-1.1.7-UNICODE_svn-1.1.4.msi. (It doesn't have to be the exact same version as the svn installer you got in step 1. See the compatibility chart.)
  2. Install the server and the command-line client
    1. Run svn-x.y.z-setup.exe and let it install stuff.  运行svn安装文件exe
    2. Go to Control Panel > System, go to the Advanced tab, and click the "Environment Variables" button at the bottom. Click the "New" button (either one, but if you're undecided, use the one under "System variables"), set "variable name" to SVN_EDITOR, and "variable value" to the path and filename of a text editor of your choice (e.g., C:\Windows\Notepad.exe). OK all the way out.  编辑系统环境变量,添加SVN_EDITOR = C:\Windows\Notepad.exe。
  3. Create a repository and configure access
    1. Create a new directory somewhere out of the way; this is where your repository will live, but you'll almost never actually open the files directly. I made a directory called svn_repos directly under my C:\Documents and Settings, just so it'd be out of the way.  创建存放svn的根目录
    2. Open a command prompt and type: svnadmin create "C:\Documents and Settings\svn_repos"  打开cmd窗口,输入 svnadmin create "F:\SVN";
    3. In Windows Explorer, browse to the C:\Documents and Settings\svn_repos\conf directory (which svnadmin just created for you), and edit a couple of config files:  打开刚才指定的目录 
      1. Open the svnserve.conf file in a text editor, and uncomment the [general], anon-access = read, auth-access = write, and password-db = passwd lines. Save.  编辑svnserv.conf文件,然后将anon-access = read, auth-access = write, and password-db = passwd  前面的注释去掉
      2. Open the passwd file in a text editor, uncomment the [users] line, and add the username and password you want to use when connecting to your subversion server. Save.  然后打开passwd文件,添加一个用户名、密码键值对
  4. Start the server manually, and create a project 手动启动服务,并创建一个项目
    1. In your command window, type: svnserve --daemon --root "C:\Documents and Settings\svn_repos" 在一个cmd窗口中输入以上指令
    2. Open a second command window, and type svn mkdir svn://localhost/monkey 再打开一个cmd窗口,然后输入svn mkdir svn://localhost/*** 
    3. You'll see the text editor you specified in step II.2, with some text already in it. Type a comment, like "Created the monkey project", at the beginning of the file (before the line starting with "--"). Save the file and close the editor. 这时候将出现一个文本文件,在第一行随便输入一些信息然后点击保存并关闭
    4. If your Subversion login is the same as your Windows login, then type your password (the one you put in the passwd file) at the prompt, and hit Enter. If your Subversion login is different from your Windows login, then just hit ENTER at the password prompt, and Subversion will then ask for both your login and your password. 如果你的subversion跟你的windows登陆方式一样,则输入密码,否则 直接enter,然后按照提示输入前面设置的用户名和密码
    5. Subversion should tell you that it "Committed revision 1." Congratulations! You just checked a change into Subversion. Throw yourself a party. (Yes, creating a directory is a revisioned change — you can go back and get the repository as of a time before that directory existed. This is novel stuff for folks like me who still use VSS at work.) 这个时候subversion将提示你第一个版本创建成功
    6. It's conventional to have /trunk, /branches, and /tags subdirectories for each project (your code goes into trunk, and the others are where you put, well, branches and tags). Go ahead and type svn mkdir svn://localhost/monkey/trunk (and notice that, after you enter a checkin comment, it doesn't prompt you for your password again — it's smart like that). 当然可以通过同样的方式创建trunk、branches等
  5. Start the server for real 启动服务器 
    1. Go back to the command window that's running svnserve. Hit Ctrl+C to stop it.返回刚才启动服务的cmd窗口,使用ctrl + C退出
    2. Open the SVNService.zip that you downloaded earlier. Extract SVNService.exe into your Subversion bin directory (Program Files\Subversion\bin). Yes, it's important that you put it in this directory; it has to be in the same place as svnserve.exe from the Subversion distribution.  打开SVNService.zip,解压里面的exe到安装subversion的bin下。
    3. In a command prompt, type svnservice -install --daemon --root "C:\Documents and Settings\svn_repos" 然后再cmd窗口下输入 svnservice -install --daemon --root “”
    4. Go to Control Panel > Administrative Tools > Services, double-click the SVNService service, and change its startup type from "Manual" to "Automatic". Now Subversion will start every time you start Windows.  然后进入windows的服务管理窗口,将手动改成自动,以后就可以随开机启动了。。。
    5. Start the SVNService service (by selecting it in the Services list, and clicking the "play" toolbar button). 启动SVNService服务
    6. Go back to a command prompt, and type svn ls svn://localhost/
      This will list all the files in the root of the repository. If all is well and you've got a real Subversion server running now, you should see: monkey/ 返回cmd窗口,可以svn ls svn://localhost,查看 所有的项目
  6. Install TortoiseSVN 下面安装小乌龟 就不说了
    Sure, you can get by with a command-line client, but TortoiseSVN is cool — it integrates Subversion into Windows Explorer. You get little overlay icons showing the status of each file (in sync, needs to be checked in, not yet in the repository, etc.), and you can do pretty much everything you need by right-clicking on files and folders.
    1. Run the TortoiseSVN installer you got back in part I.
    2. Create a monkey directory somewhere on your hard drive. Right-click somewhere in that folder and select "SVN Checkout..." Type svn://localhost/monkey/trunk/ for the repository URL and click OK.
    3. Create a file in that directory, any file. Right-click the file and select TortoiseSVN > Add. Notice the little plus-sign icon that appears.
      The file hasn't actually been checked in yet — Subversion's commits are both batched and atomic, so this new file, together with any other new files you added, any files you changed, any files you deleted, any files you renamed, any directories you added or deleted or renamed, will all show up on the server all at once, as a single revision and a single checkin, the next time you right-click and select "SVN Commit".
  7. Make it run on the network
    Are you kidding? You're already networked. Go to another computer on your LAN, install TortoiseSVN, and do an "SVN Checkout...". When you specify the repository URL, use the same URL you did before, but replace "localhost" with the actual name of the computer that's running the Subversion service (so in my case, the repository URL is svn://marsupial/monkey/trunk/ — nice little menagerie, there).

And there ya go — Subversion up and running on Windows, in mere moments or less.

Corrections, questions, etc. on this document are, as always, welcome; just speak up in the comments. Now go forth and control your revisions.

原文地址: http://www.excastle.com/blog/archive/2005/05/31/1048.aspx

 

0
2
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics