111
votes
mark@mark-ubuntu:~/myproject$ svn stat
?       runserver.sh
?       media/images/icons
?       apps/autocomplete
mark@mark-ubuntu:~/myproject$ svn add apps/autocomplete
svn: warning: 'apps/autocomplete' is already under version control

svn stat says its not under version control, so I try to add it, and then it tells me it is. When I do an svn ci, it doesn't get comitted, and doesn't show up when I try to browse to repository online.

How do I get it to commit?

8
Does the "autocomplete" folder contain a broken ".svn" subdirectory? Also, did you cleanup? :)bzlm
Have you tried a: svn cleanup, just a stab in the dark?shaunhusain
I ran into this issue when I had copied a checked in directory to another folder in my project. Deleting the old .svn works!paulrehkugler
I forcefully added the files: svn add --force /path/to/file, or if you want to add directory recursively: svn add --depth infinity --force /path/to/directory.joker

8 Answers

163
votes

Copy problematic folder into some backup directory and remove it from your SVN working directory. Remember to delete all .svn hidden directories from the copied folder.

Now update your project, clean-up and commit what has left. Now move your folder back to working directory, add it and commit. Most of the time this workaround works, it seems that basically SVN got confused...

Update: quoting comment by @Mark:

Didn't need to move the folder around, just deleting the .svn folder and then svn-adding it worked.

20
votes

I had a similar-looking problem after adding a directory tree which contained .svn directories (because it was an svn:external in its source environment): svn status told me "?", but when trying to add it, it was "already under version control".

Since no other versioned directories were present, I did

find . -mindepth 2 -name '.svn' -exec rm -rf '{}' \;

to remove the wrong .svn directories; after doing this, I was able to add the new directory.

Note:

  • If other versioned directories are contained, the find expression must be changed to be more specific
  • If unsure, first omit the "-exec ..." part to see what would be deleted
15
votes

A variation on @gauss256's answer, deleting .svn, worked for me:

rm -rf troublesome_folder/.svn
svn add troublesome_folder
svn commit

Before Gauss's solution I tried @jwir3's approach and got no joy:

svn cleanup
svn cleanup *
svn cleanup troublesome_folder
svn add --force troublesome_folder
svn commit
14
votes

(1) This just happened to me, and I thought it was interesting how it happened. Basically I had copied the folder to a new location and modified it, forgetting that it would bring along all the hidden .svn directories. Once you realize how it happens it is easier to avoid in the future.

(2) Removing the .svn directories is the solution, but you have to do it recursively all the way down the directory tree. The easiest way to do that is:

find troublesome_folder -name .svn -exec rm -rf {} \;
3
votes

Have you tried performing an svn cleanup?

3
votes

Check for a directory 'apps/autocomplete/.svn'. Move it somewhere safe (in case you need to restore it because this did not work) and see if that fixes the problem.

0
votes

I found a solution in case you have installed Eclipse(Luna) with the SVN Client JavaHL(JNI) 1.8.13 and Tortoise:

Open Eclipse: First try to add the project / maven module to Version Control (Project -> Context Menu -> Team -> Add to Version Control)

You will see the following Eclipse error message:

org.apache.subversion.javahl.ClientException: Entry already exists svn: 'PathToYouProject' is already under version control

After that you have to open your workspace directory in your explorer, select your project and resolve it via Tortoise (Project -> Context Menu -> TortoiseSVN -> Resolve)

You will see the following message dialog: "File list is empty"

Press cancel and refresh the project in Eclipse. Your project should be under version control again.

Unfortunately it is not possible to resolve more the one project at the same time ... you don't have to delete anything but depending on the size of your project it could be a little bit laborious.

0
votes

For me doing a svn update, followed by svn commit worked. There were no .svn folders present in folder which was failing to add.