能否在本地搭建Tortoise SVN repository,实现异地协作与本地多盘开发?
Absolutely feasible—this is a classic centralized workflow that Subversion was built for, even with remote collaborators. Let me walk you through exactly how to pull this off, step by step:
1. Create & Initialize Your D-Drive Repository
- First, fire up TortoiseSVN and use the Repo-browser, or run this command in a terminal to create the repo directly:
svnadmin create D:\path\to\your\target\repo-folder - Next, set up the standard Subversion folder structure (a best practice for long-term management): Right-click the repo root in Repo-browser → Create folder, and make three folders:
trunk(for active development),tags(for stable releases), andbranches(for feature work).
2. Checkout to Your E-Drive for Local Development
- Navigate to the folder on your E-Drive where you want to work, right-click → TortoiseSVN → Checkout.
- In the "URL of repository" field, enter your local repo path using the
file:///protocol (note the three slashes):file:///D:/path/to/your/repo-folder/trunk - Click OK, and you’ll have a working copy on E-Drive ready for coding, commits, and updates.
3. Let Your Remote Friend Commit to the D-Drive Repo
You’ll need to expose your D-Drive repo over the internet so your friend can access it. Two solid options:
Option 1: Set Up an SVN Server (Most Stable)
- Use either the built-in
svnservetool or VisualSVN Server (a GUI-based server that’s easier to manage):- For
svnserve: Open a terminal as admin and run:
Thesvnserve -d -r D:\path\to\your\repo-folder-dflag runs it as a background service, and-rsets the root of your repository. - Configure permissions: Go to
D:\path\to\your\repo-folder\conf, editsvnserve.conf—uncomment the lines foranon-access = readandauth-access = write, then setpassword-db = passwd. Openpasswdand add a username/password pair for your friend. - Your friend will need your public IP address (find it via
ipconfigor a public IP lookup tool), and their checkout URL will be:
They’ll enter the username/password you set to commit changes. Don’t forget to forward port 3690 (svnserve’s default) on your router so their requests can reach your machine.svn://your-public-ip/trunk
- For
Option 2: Network Share (Simpler, Less Reliable for Remote)
- If you’re on the same local network, you can share the D-Drive repo folder directly. Your friend would use a URL like:
file:///your-local-network-ip/path/to/repo-folder/trunk - For remote access, you’d need a VPN or a file-sharing tool that exposes your local drive over the internet (like TeamViewer’s file sharing). This is quicker to set up but less stable than a dedicated SVN server.
4. Backup Strategy to Protect Your Repository
Since you’re relying on a local repo, regular backups are critical:
- Full Backups: Use TortoiseSVN’s built-in backup tool (right-click the repo → TortoiseSVN → Backup) or run this command to export a full snapshot:
svnadmin dump D:\path\to\your\repo-folder > D:\repo-backups\full-backup-YYYY-MM-DD.svn - Incremental Backups: To save space between full backups, run an incremental dump that only captures changes since your last backup:
svnadmin dump --incremental -r [last-backup-revision]:HEAD D:\path\to\your\repo-folder > D:\repo-backups\incremental-backup-YYYY-MM-DD.svn - Offsite Backup: Copy your backup files to an external hard drive or cloud storage (like a local cloud sync folder) to avoid losing everything if your D-Drive fails.
Quick Tips to Avoid Headaches
- Never let anyone edit files directly in the D-Drive repo folder—all changes must go through a working copy (checkout) to keep the repo intact.
- Run
svnadmin cleanupon the repo occasionally to fix any locked files or performance issues. - If your public IP changes regularly, consider using a dynamic DNS service so your friend doesn’t have to update the URL every time.
内容的提问来源于stack exchange,提问作者Amrit
相关产品推荐
相关产品推荐

