How to fix path is not a working copy directory and working copy is already locked errors

A few days ago I was writing some code to generate reports. After the reports were generated, the reports were emailed, then deleted off the server. I made a mistake and deleted the contents of the directory.

This was a bad thing because all of the .svn files were also deleted. I tried to replace the directory contents with the latest from SVN and I got an error. I tried to update my working copy and got an error. No matter how I interacted with SVN, I got one of the following errors:

  • Path is not a working copy directory
  • Working copy is already locked
  • Working copy '[directory]' is missing or not locked

To fix this:

I manually removed the directory entirely from my local copy. Then I updated to HEAD from SVN. This created the directory I accidentally deleted, put the files back and also added in the .svn files that were missing (and causing the working copy errors)

Apparently, if the directory exists, and SVN doesn't find the .svn files it is looking for, it gets confused. Removing the directory is enough for it to recreate it. (Since the missing directory was tracked in the parent directory .svn files)

Hope this helps you out!

There are no comments for this entry.

Add Comment Subscribe to Comments

9/2/10 4:38 PM # Posted By Jim Priest

I've done that before! I find it's always a good idea to interact with any files (delete, rename, move, etc.) under version control through SVN. TortoiseSVN on Windows makes this easy with it's shell integration.

10/7/10 4:35 AM # Posted By Mike Blyth

Thanks, that worked and was easy! I had to copy the contents of the "bad" folder back into the new one, rather than just copying the whole folder again.

5/8/12 9:36 PM # Posted By Greg

From Tortoise menu: Release lock

8/26/13 9:16 PM # Posted By garrydam

With Path too long error I use "Long Path Tool" to get fast and easy fix .

Add Comment Subscribe to Comments