Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to set up an SVN repository on my computer without any network access. I am working on a code without any collaborator, so I don't want it to be publicly available.

I read this post, but it suggests using online SVN repository services that give free repositories. In that case, my code will be publicly available (as is included in the terms of free plans).

So I was wondering if I can set up a local server on my Windows XP machine that only I access even when I don't have any internet connection?

share|improve this question
14  
I'd strongly recommend using git over something like svn for the workflow you've described –  Daenyth Mar 29 '12 at 15:54
7  
You certainly can install svn locally and use it. No issues with that. visualsvn.com/server/download –  Alex Mar 29 '12 at 15:57
8  
Or Mercurial; "hg init" creates a repository in the directory you're in... can't be much easier than that? –  perp Mar 29 '12 at 15:57
6  
I see nothing in the question to suggest a DVCS is necessary. Subversion is the perfect fit for the scenario described. Let's not blur our answers with recommendations for alternatives when there's no technical reason to do so. –  RichardM Mar 29 '12 at 17:12
3  
@RichardM : There is nothing wrong in suggesting another solution if it is easier to setup and more future-proof. A DVCS provides many other benefits if the OP wants to collaborate with other people one day. –  marco-fiset Mar 29 '12 at 17:24

5 Answers 5

The easiest way to set up a local server is to use svnserve:

Subversion includes Svnserve - a lightweight stand-alone server which uses a custom protocol over an ordinary TCP/IP connection. It is ideal for smaller installations, or where a full blown Apache server cannot be used.

You don't actually need a subversion server though, if all you want to do is access the repository locally, since you can access a subversion repository via a file URL, as described in this answer:

You can access the repository using file:// protocol so you will only need Tortoise SVN installed and nothing else. See this question in FAQ: Is it possible to use TortoiseSVN without a server?

You can even have the repository in the usb device so that you can take the source with you and work on in from other computers.

If you are using TortoiseSVN, then you can find instructions at Creating The Repository With TortoiseSVN:

  1. Open the windows explorer

  2. Create a new folder and name it e.g. SVNRepository

  3. Right click on the newly created folder and select TortoiseSVN → Create Repository here....

Immediately above on this page also describes how to create a repository from the command line.


Having said that, I would recommend that you have a look at Mercurial as an alternative to svn though. If you are familiar with TortoiseSvn then you will find TortoiseHg an easy transition and it gives you the flexibility to work in a distributed way later if you need to. For instance in the past I've used memory sticks to transfer hg repositories between machines without network access, and you get a free backup into the bargain when you work this way.

share|improve this answer
    
broken link svn server –  HIT Aug 25 at 10:32
    
First think I am not interested in earning rep in this stack-exchange, Second thing if I dont know the right link how can i edit this –  HIT Aug 27 at 14:05
    
No problem @AnonymousMohit just trying to help. Please tidy up after yourself by deleting your comments now they are no long needed. –  Mark Booth Aug 27 at 15:21

Lets try an answer that recommends generic solutions rather than specifics.

Firstly yes, you can use Subversion on a standalone computer - you can install the server locally or you can work with file://


But unless there is a very good reason why you have to use subversion I would suggest that this is not the best solution to the problem of local version control - not least because it fails one of the things that I regard as essential i.e. ensuring that you source code is in at least two places (yes, even for personal stuff). I would therefore suggest use of a Distributed Version Control System (DVCS).

One of the benefits of DVCS is that, once the tools are installed, repositories are self contained within a folder and you can sync content between different folder containing the "same" repo so long as you have file level access. You also have the option to talk to "server" versions of those repos (that are either privately hosted or that are available as a service). This makes life a lot easier running everything locally.

There are other advantages to DVCS too.

As I already noted, I don't think you really have a proper VCS solution 'til your code is on at least two machines (specifically two distinct hard disks and ideally in more than one location - although cloning and pushing to say USB stick or "cloud" storage (skydrive, dropbox, et al) is another way that should work as well).

In terms of which DVCS - I would look at Mercurial (Hg) and Git and also at Veracity. I use Mercurial because its still nicer on windows...

If you terms of hosted services I do actually agree that there is an awful lot to commend github - but there are also a lot of nice things about bitbucket and Fogbugz/Kiln... and the same is probably true of a lot of other services which I haven't listed (e.g http://beanstalkapp.com/ which was mentioned in passing to me on twitter earlier today)

share|improve this answer

Simplest (and fastest) server, which you can use for work with local repository, embedded into every svn-client. This is server for accessing any repository and any amount of repositories, existing on local filesystem, using protocol file:///. It doesn't provide any authorization or authentication methods, grant only full unlimited access to repository under control, but, from other side, it allows to use and gives all features of VCS-system per se.

In order to use this server, you have in any empty directory in any location call CLI-command svnadmin with the corresponding subcommand and parameters (I can't recall, are there administrative programs in the CLI-client bundle or not and can't check it - I haven't installed CLI svn-client, only TortoiseSVN, which have these programs in installer in version 1.7) - I hope, you'll be able to find it.

svnadmin help show us all available subcommands, we are now interested in subcommand create.

svnadmin help create provide all needed for us details

create: usage: svnadmin create REPOS_PATH

Create a new, empty repository at REPOS_PATH.

Valid options:
...

At starting point for first repo we can ignore all fine-tune options and remember only main form svnadmin create REPOS_PATH, there REPOS_PATH is absolute or relative path to empty directory, planned for repo. Because most time ordinary Windows-people for cross-platform application may people may be confused, which notation (forward- or backslashes) to use in path (metoo), the safest way is cd to location, from which our dir is visible without long path - parent of future repo-directory or the directory itself. For planned for repo z:\Main before svnadmin create

Z:
cd \Main

and, at last,

svnadmin create .

As result we get created empty repository in directory, which shown in Windows Explorer with special icon as content-indicator

RepoFolder

Now, every time when this repository is needed, we use usual SVN-commands, there URL-part or parameters seems as file:///Z:/Main

c:\>svn ls file:///Z:/Main
branches/
tags/
trunk/

(I added standard repository tree in repo).

Let's dissect this strange URL:

  • file:///, as for any URL, means access-protocol, in our case protocol is special, and have three, not two slashes
  • Z:/Main is full path to repo with drive and path inside drive, there all Windows-backslashes replaced by "classic" forward-slashes

From any other point this repository haven't any differences from "Big Brothers" with special Subversion-servers

RepoBrower for file:/// repo

share|improve this answer
1  
@Lazy Badger The OP clearly asked how to set up a svn server. You told him to avoid using any server at all. This avoids answering the question, as stated. –  alternative Mar 29 '12 at 21:27
3  
@mathepic - actually the OP asks how to set up a SVN repository not a server - huge difference. –  Murph Mar 30 '12 at 8:51

Subversion does not require a server. It uses a centralized repository, but this repository can be accessed through the 'file' access method, which means, you merely need access to the filesystem that the repository is stored on. The easiest way to set this up would be to create a folder somewhere on your hdd, point TortoiseSVN (or a similar tool) at it, and 'create repository here'. From there, you can do whatever you need to get your code into the repository.

However, in the long run, you're probably better off using a distributed SCM, the best candidates being git (more powerful, steep learning curve, works best on *nix) and mercurial (slightly less powerful, easy to learn, works equally well on windows and *nix). With these, your working copy contains the entire repository, and you can make as many clones (remote or local) as you wish. You can start out locally, and if you decide to host the repository externally, you simply clone your existing local repository to the external location, and you can synchronize in both directions at any time. Better yet, because each of your clones contains the entire project history, the SCM doubles as a backup system. With subversion, if your server dies and you haven't backed it up, your history is gone - with git, you just clone your working copy to a new server and that's it.

http://hginit.com/ has an excellent tutorial on getting started with mercurial.

share|improve this answer

There are quite a few SVN hosting companies that offer a free account for one or two developers and don't require that your code be public. Check the linked chart for $0 fee, OSS Required = NO. I count nine providers that meet those criteria right now.

While you can certainly host your own repository very easily, there are some benefits that come with using a provider:

  • You can access your code from anywhere with no extra setup.

  • Keeping your code off-site protects you from hard disk crashes, fires, etc.

  • Low administrative overhead.

share|improve this answer
    
I see reasonable concept on OP side - he want SVN, and want it locally (last word - most important). Casual use-case. You answered on different use-case, which can be considered "Not an answer" - re-read your text from first words, please! I didn't flagged your and others answers as "not an answer", while formally they are not answers. HTH –  Lazy Badger Mar 29 '12 at 19:24
    
Re-read LAST SENTENCE of OP: " if I can set up a local server on my windows xp machine that only I access even when I don't have any internet connection?" - this is question, in plain English text. This question require answer. Does your "answer" correlate in any way with question?! Be honest at least to himself, recognizing the mistakes –  Lazy Badger Mar 29 '12 at 19:44
    
I don't read between lines (and showed this more than once), I read exactly what was written and answer on asked question, without thinking of the author, that he wanted to say but not say. Contrary to most answers in this topic, there answers doesn't correlate to question –  Lazy Badger Mar 29 '12 at 19:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.