Visit Sponsor

Written by 9:11 am Subversion

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!

Visited 76,386 times, 1 visit(s) today
[mc4wp_form id="5878"]
Close