git-crypt icon indicating copy to clipboard operation
git-crypt copied to clipboard

Document how to undo git-crypt, e.g. remove item from .gitattributes

Open dazza-codes opened this issue 5 years ago • 6 comments

There is documentation about how to apply git-crypt, but nothing to un-apply it. What happens when a file that is encrypted, with an entry in the .gitattributes file to use the git-crypt filters, and a new commit removes the .gitattributes entry? How is a file intentionally released from git-crypt filters?

dazza-codes avatar Feb 21 '19 22:02 dazza-codes

  1. Checkout and unlock a copy of the repository.
  2. Remove the relevant attribute filter lines.
  3. git-add the unlocked state of the files that were previously encrypted from your working directory and commit them.

alerque avatar Feb 24 '19 08:02 alerque

FWIW, I found that my PR on GitHub to unencrypt a file showed the .gitattributes changes but the file still looked encrypted. You are able to view the file however and it is unencrypted.

redthor avatar Oct 23 '19 23:10 redthor

1. Checkout and unlock a copy of the repository.

2. Remove the relevant attribute filter lines.

3. `git-add` the unlocked state of the files that were previously encrypted from your working directory and commit them.

Doesn't work. first off git-add is not found... then did git add after unlock, update .gitattribute. File pushed still encrypted on github. (locally it's not encrypted, but if I clone again it would be)

yangzii0920 avatar Jul 24 '20 20:07 yangzii0920

Had same issue. Only next tricky works for me (problem file is a foo.py in this example):

  • cat foo.py > spam.py
  • git add spam.py; git commit -m "added version without enc"; git push
  • delete foo.py mention from .gitattributes file
  • git rm foo.py
  • git add .gitattributes.py; git commit -m "delete encrypted version"; git push
  • git mv spam.py foo.py; git commit -m "rename version without encyption"; git push

ilia-tsyplenkov avatar Sep 04 '20 11:09 ilia-tsyplenkov

To avoid multiple commits and moved around files the following worked for me:

  • checkout and unlock repo
  • remove [filter "git-crypt"] and [diff "git-crypt"] sections from .git/config
  • remove corresponding lines in .gitattributes and add changes to the index
  • remove symmetric key (if any) rm .git/git-crypt -r
  • remove (encrypted) path only from the index git rm --cached foobar
  • re-add local (unencrypted) path to the index git add foobar
  • commit and push the changes

hvhaugwitz avatar Mar 02 '21 10:03 hvhaugwitz

I tried @ilia-tsyplenkov and @hvhaugwitz workarounds but my file is style encrypted and considered as binary on Github entreprise.

My problem with their solutions is that .gitattributes has already been modified before.

Tointoin avatar Nov 09 '21 10:11 Tointoin