git-crypt
git-crypt copied to clipboard
Document how to undo git-crypt, e.g. remove item from .gitattributes
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?
- Checkout and unlock a copy of the repository.
- Remove the relevant attribute filter lines.
-
git-add
the unlocked state of the files that were previously encrypted from your working directory and commit them.
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.
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)
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
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
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.