SVN – How to fix “working copy locked”

What causes this problem

Occasionally, when a commit, add, or another SVN action fails, it’ll lock itself. It does this so it cannot be corrupted by other subsequent failures. I’ve mostly experienced this while using TortoiseSVN. I bet it can happen in other clients or via the CLI as well.

You can know you’re in this situation when you get a message like this:

svn: Working copy ‘/myrepo/repodirectory’ locked
svn: run ’svn cleanup’ to remove locks (type ’svn help cleanup’ for details)

Every now and then it won’t tell you to try to execute a cleanup to fix the issue.  This can be frustrating.

How to fix it

Running svn cleanup typically fixes your problem.  If not, you will need to make sure you are at the root of your repository.  For example,  if you are in ‘/myrepo/repodirectory,’ you will need to ‘cd ..’ so that you are at ‘/myrepo’ and then try executing ‘svn cleanup’ again.

Here’s an example of what I had to do to fix this issue:

C:\myrepo\repodirectory> cd ..
C:\myrepo> svn cleanup

Its nice when fixing something is as simple as a svn cleanup.

21 responses to “SVN – How to fix “working copy locked””

  1. Worked great for me today, thanks!

    1. I’m glad it helped! I ran into this issue and was trying to figure it out for quite a while and so I’m happy that it’s helping others fix their issues.

  2. Thanks Ryan, that worked perfectly. Much appreciated.

  3. Hi Ryan,
    thank you for posting. My repository is ok now.
    It was really helpful.

    1. No problem! It’s a simple fix but useful 🙂

    2. No problem, Mario! I’m glad it helped.

  4. You could fix this using the cleanup method.

    Go to the root folder
    Do a SVN cleanup
    Update the files from the root folder itself.
    Then commit your desired folder.

    If this method doesn’t help, Try the following

    Copy or rename the folder which causes the issue.
    Do an SVN update from the root folder.
    The older version will be updated.
    Compare the reverted code with the new code using comparing software like WinMerge.
    Commit the files.

    reference : http://www.htmlexplorer.com/2014/02/fix-common-svn-commit-errors-locked-out.html

    1. thanks , this post was helpfull

  5. locksmith nyc upper west side

    SVN – How to fix “working copy locked” | Ryan Olson

  6. Thanks. Your post was very helpful.

  7. this post is helpful.. thanks very much..
    I could cleanup with “Clean up” option in Tortoise Git

    1. I meant Tortoise SVN tool 🙂

  8. Hi All,

    Ma facing same issue (working directory locked ),

    but when i ran svn cleanup also not working . it is giving below error .

    svn: In directory ‘.’
    svn: Error processing command ‘committed’ in ‘.’
    svn: Error replacing text-base of ‘svnaccess’
    svn: Can’t move ‘.svn/tmp/tempfile.12.tmp’ to ‘svnaccess’: Permission denied

    any one please help me with this .

    Thanks,
    Vishnu.

  9. thank you so much! I have fixed the frustranting problem with this. 🙂

  10. thank you sir!!!!!!!!

  11. thank you sir…this was so helpful!!!

  12. Hmm is anyone else encountering problems with the images on this
    blog loading? I’m trying to determine if its a
    problem on my end or if it’s the blog. Any feedback would be greatly appreciated.

  13. Thanks
    This was very helpful. So logical missed it to try before looking at your valuable post.

  14. medical help

    SVN – How to fix “working copy locked” | Ryan Olson

Leave a reply to Devapriya Cancel reply