git-crypt Transparent repo encryption
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
git-crypt initecho 'secrets/** filter=git-crypt diff=git-crypt'
>> .gitattributes
git-crypt status
git-crypt add-gpg-user <user-id>
git-crypt export-key <file>
git-crypt unlock
git-crypt unlock <keyfile>
git-crypt lockConcepts
- Working tree plain text
- Repository encrypted blobs
- Remote ciphertext only
Setup
git-crypt initgit-crypt init -k <name>
git-crypt help [<command>]
git-crypt version
Choosing files
<path> filter=git-crypt diff=git-crypt
secrets/** filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt
.gitattributes !filter !diff
git add .gitattributes && git commit
git check-attr filter -- <file>
Status
git-crypt status
git-crypt status -e
git-crypt status -u
git-crypt status -f
git diffSharing access
git-crypt add-gpg-user <user-id>
git-crypt add-gpg-user -n <user-id>
git-crypt add-gpg-user --trusted <user-id>
git-crypt add-gpg-user -k <name>
<user-id>
git-crypt export-key <file>
git-crypt export-key -k <name> <file>
gpg --import <pubkey>
Lock and unlock
git-crypt unlock
git-crypt unlock <keyfile>
git-crypt lockgit clone <url> && cd <repo> &&
git-crypt unlock
git-crypt lock --force
Recipes
git initgit-crypt initecho 'secrets/** filter=git-crypt diff=git-crypt' > .gitattributesecho '.gitattributes !filter !diff' >> .gitattributesgit add .gitattributes && git commit -m 'Add git-crypt rules'# now add and commit files under secrets/git-crypt status -e
gpg --import colleague.pubgit-crypt add-gpg-user colleague@example.comgit push# colleague then runs:git clone <url> && cd <repo> && git-crypt unlock
git-crypt export-key ../repo.key# store the file as a CI secret, then in the job:git-crypt unlock "$KEY_FILE"
# add the rule to .gitattributes, commit it, then:git-crypt status -fgit commit -m 'Encrypt secrets'# old history still holds the plain text



