<p>One of my co-workers checked in a some files in SVN and one of the files has a password in it. The password has been removed from the file and a new version checked in but the password is obviously still in the repository if we look at the revision history and go to that revision. (We're using TortoiseSVN as the client.)</p>

<p>So how do I securely delete that single file from the repository in SVN?</p>

[{'answer_id': 33782, 'author': 'Bernard', 'author_id': 61, 'author_profile': 'https://Stackoverflow.com/users/61', 'pm_score': -1, 'selected': False, 'text': "<p>I'm not sure. You could always create a new file and copy the latest revision into that, wiping out prior revision history. </p>\n"}, {'answer_id': 33783, 'author': 'Mike Thompson', 'author_id': 2754, 'author_profile': 'https://Stackoverflow.com/users/2754', 'pm_score': 1, 'selected': False, 'text': '<p>Maybe you should change your production password to avoid the svn problem altogether.</p>\n'}, {'answer_id': 33784, 'author': 'Jason Baker', 'author_id': 2147, 'author_profile': 'https://Stackoverflow.com/users/2147', 'pm_score': 5, 'selected': True, 'text': '<p><a href="http://subversion.apache.org/faq.html#removal" rel="nofollow noreferrer">link to subversion FAQ entry on this</a></p>\n'}, {'answer_id': 33786, 'author': 'Adam', 'author_id': 3142, 'author_profile': 'https://Stackoverflow.com/users/3142', 'pm_score': 3, 'selected': False, 'text': '<p>It isn\'t pretty: <a href="http://subversion.tigris.org/faq.html#removal" rel="nofollow noreferrer">How do I completely remove a file from the repository\'s history?</a></p>\n'}, {'answer_id': 33808, 'author': 'Guy', 'author_id': 1463, 'author_profile': 'https://Stackoverflow.com/users/1463', 'pm_score': 0, 'selected': False, 'text': "<p>That seemed to work. So what I did was:</p>\n\n<ol>\n<li>Copy the file to another folder.</li>\n<li>Do a TortoiseSVN delete from the current folder followed by a commit.</li>\n<li>Copy the file back in to the folder.</li>\n<li>Add the file using TortoiseSVN and commit again.</li>\n</ol>\n\n<p>I can't seem to find any revision history now - however, it could just be that I'm not looking in the right place.</p>\n\n<p>So a modified question would now be, how can I find the revision history of the file that was deleted and then resubmitted to SVN?</p>\n\n<p>(BTW I apologize for not asking the question more accurately earlier as I never mentioned that one of the options was to obliterate all revision history as it hadn't occurred to me.)</p>\n"}, {'answer_id': 33830, 'author': 'Damien B', 'author_id': 3069, 'author_profile': 'https://Stackoverflow.com/users/3069', 'pm_score': 2, 'selected': False, 'text': "<blockquote>\n  <p>I can't seem to find any revision history now - however, it could just be that I'm not looking in the right place.</p>\n</blockquote>\n\n<p>You can see it by looking at the folder history, which will give you the revision where the file was still there, and thus you'll be able to recover the confidential file. So it's a bad solution.</p>\n"}, {'answer_id': 56724, 'author': 'Sam Hasler', 'author_id': 2541, 'author_profile': 'https://Stackoverflow.com/users/2541', 'pm_score': 2, 'selected': False, 'text': '<p>If it\'s the <strong>last</strong> revision (HEAD) you can (<strong>BACKING UP</strong> your repo beforehand) delete that revision\'s files in <code>db\\revs</code> and <code>db\\revprops</code> and then run the following python script to fix what revision you repo thinks HEAD is.</p>\n\n<p>e.g. if head is 522 and the password was commited in 520, you\'d have to delete revisions 520,521 and 522. </p>\n\n<p>(This script shouldn\'t be necessary once <a href="http://subversion.tigris.org/issues/show_bug.cgi?id=516" rel="nofollow noreferrer">SVN obliterate</a> is implemented)</p>\n\n<p>(I didn\'t write this script, I got it from <a href="http://svn.haxx.se/users/archive-2005-12/0630.shtml" rel="nofollow noreferrer">here</a>)</p>\n\n<pre><code>#!/usr/bin/python\n\ndef dec_to_36(dec):\n  key = \'0123456789abcdefghijklmnopqrstuvwxyz\'\n  result = \'\'\n  while 1:\n    div = dec / 36\n    mod = dec % 36\n    dec = div\n    result = key[mod] + result\n    if dec == 0:\n      break\n  return result\n\n\nimport os, re, sys\n\nrepo_path = sys.argv[1]\nrev_path = os.path.join(repo_path, \'db\', \'revs\')\ncurrent_path = os.path.join(repo_path, \'db\', \'current\')\n\nid_re = re.compile(r\'^id:\\ ([a-z0-9]+)\\.([a-z0-9]+)\\.r([0-9]+).*\')\n\nmax_node_id = 0\nmax_copy_id = 0\nmax_rev_id = 0\n\nfor rev in os.listdir(rev_path):\n  f = open(os.path.join(rev_path, rev), \'r\')\n\n  for line in f:\n    m = id_re.match(line)\n    if m:\n      node_id = int(m.group(1), 36)\n      copy_id = int(m.group(2), 36)\n      rev_id = int(m.group(3), 10)\n\n      if copy_id &gt; max_copy_id:\n        max_copy_id = copy_id\n\n      if node_id &gt; max_node_id:\n        max_node_id = node_id\n\n      if rev_id &gt; max_rev_id:\n        max_rev_id = rev_id\n\nf = open(current_path, \'w+b\')\nf.write("%d %s %s\\n" % (max_rev_id, dec_to_36(max_node_id+1),\n                        dec_to_36(max_copy_id+1)))\nf.close()\n</code></pre>\n'}, {'answer_id': 418926, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>your password is still there (svn cat file@2342 where 2342 is a revision the file was still there).</p>\n\n<p>you can \'\'svnadmin dump\'\' you repos to a file, search and replace you password with "ultrasecret\', \'\'svnadmin create\'\' a new repos and \'\'svnadmin load\'\' the modified dump into that new repos. be aware of binary data in your dump, so use a proper editor/sed.</p>\n'}]
['https://Stackoverflow.com/questions/33778', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1463/']