How to fix svn: ‘path/to/dir’ is not a working copy directory


I'm trying to do a commit, and I'm getting the error above. I see a few questions on here along the same lines, but the solution always seems to be "delete and re-checkout". I'm trying to add some files for the first time, so I can't delete. I also tried just removing the files, but then I get this error instead:

svn: Directory '/path/to/dir' is missing

I think the problem originally stemmed from a permissions error — I didn't have permission to write the .svn files when I did my initial add command. How can I fix this? The only thing I've thought of would be to clear out all .svn folders from the project, and re-import into a fresh repository. Bleh!

Best Solution

Try re-owning all the files as your current user. .svn files should be owned by whatever user is doing the commits. If you can commit as root, that would be a good indicator you have this problem. Don't do that though, because you'll make your subversion files owned by root, which means your user won't be able to commit. Set the owner properly and try again.

If you did indeed check the project out, and are now getting that error, it indicates that SVN doesn't believe you're in a valid repo. Check your path, check your permissions, check for the actual existence of .svn files.

Really, your most surefire way to fix the problem is to copy your edited files somewhere else, wipe the directory you checked out to, and then re-check out. If you haven't checked anything into the repo yet, use the svn import command.