• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

doc/H26-Nov-2017-2517

man/H26-Nov-2017-494376

AUTHORSH A D26-Nov-201735 21

CONTRIBUTING.mdH A D26-Nov-20171.1 KiB2619

COPYINGH A D26-Nov-201734.3 KiB675553

INSTALLH A D26-Nov-20172.1 KiB7343

INSTALL.mdH A D26-Nov-20172.2 KiB7243

MakefileH A D26-Nov-20172 KiB9659

NEWSH A D26-Nov-20173.3 KiB7163

NEWS.mdH A D26-Nov-20173.3 KiB7465

READMEH A D26-Nov-20176.1 KiB158110

README.mdH A D26-Nov-20176.3 KiB160119

RELEASE_NOTES-0.4.1.mdH A D26-Nov-20171 KiB2216

RELEASE_NOTES-0.4.mdH A D26-Nov-20173 KiB8555

THANKS.mdH A D26-Nov-2017562 2418

commands.cppH A D03-May-202256.6 KiB1,6861,267

commands.hppH A D26-Nov-20172.6 KiB7735

coprocess-unix.cppH A D26-Nov-20174.7 KiB187144

coprocess-unix.hppH A D26-Nov-20172 KiB6928

coprocess-win32.cppH A D26-Nov-20177.9 KiB270190

coprocess-win32.hppH A D26-Nov-20172 KiB6928

coprocess.cppH A D26-Nov-201788 65

coprocess.hppH A D26-Nov-201788 65

crypto-openssl-10.cppH A D26-Nov-20173.3 KiB12169

crypto-openssl-11.cppH A D26-Nov-20173.2 KiB12070

crypto.cppH A D26-Nov-20172.7 KiB8236

crypto.hppH A D26-Nov-20173.2 KiB11865

fhstream.cppH A D26-Nov-20176.2 KiB228123

fhstream.hppH A D26-Nov-20173.8 KiB13581

git-crypt.cppH A D26-Nov-20178.3 KiB267195

git-crypt.hppH A D26-Nov-20171.4 KiB395

gpg.cppH A D03-May-20226.2 KiB196132

gpg.hppH A D26-Nov-20171.9 KiB5216

key.cppH A D26-Nov-20178.1 KiB337263

key.hppH A D26-Nov-20173 KiB11765

parse_options.cppH A D26-Nov-20173.2 KiB11681

parse_options.hppH A D26-Nov-20172 KiB5822

util-unix.cppH A D26-Nov-20175.5 KiB217156

util-win32.cppH A D26-Nov-20175.6 KiB213156

util.cppH A D26-Nov-20174 KiB158106

util.hppH A D26-Nov-20173.1 KiB8444

README

1ABOUT GIT-CRYPT
2
3git-crypt enables transparent encryption and decryption of files in a
4git repository.  Files which you choose to protect are encrypted when
5committed, and decrypted when checked out.  git-crypt lets you freely
6share a repository containing a mix of public and private content.
7git-crypt gracefully degrades, so developers without the secret key can
8still clone and commit to a repository with encrypted files.  This lets
9you store your secret material (such as keys or passwords) in the same
10repository as your code, without requiring you to lock down your entire
11repository.
12
13git-crypt was written by Andrew Ayer <agwa@andrewayer.name>.  For more
14information, see <https://www.agwa.name/projects/git-crypt>.
15
16
17BUILDING GIT-CRYPT
18
19See the INSTALL file.
20
21
22USING GIT-CRYPT
23
24Configure a repository to use git-crypt:
25
26	$ cd repo
27	$ git-crypt init
28
29Specify files to encrypt by creating a .gitattributes file:
30
31	secretfile filter=git-crypt diff=git-crypt
32	*.key filter=git-crypt diff=git-crypt
33
34Like a .gitignore file, it can match wildcards and should be checked into
35the repository.  See below for more information about .gitattributes.
36Make sure you don't accidentally encrypt the .gitattributes file itself
37(or other git files like .gitignore or .gitmodules).  Make sure your
38.gitattributes rules are in place *before* you add sensitive files, or
39those files won't be encrypted!
40
41Share the repository with others (or with yourself) using GPG:
42
43	$ git-crypt add-gpg-user USER_ID
44
45USER_ID can be a key ID, a full fingerprint, an email address, or anything
46else that uniquely identifies a public key to GPG (see "HOW TO SPECIFY
47A USER ID" in the gpg man page).  Note: `git-crypt add-gpg-user` will
48add and commit a GPG-encrypted key file in the .git-crypt directory of
49the root of your repository.
50
51Alternatively, you can export a symmetric secret key, which you must
52securely convey to collaborators (GPG is not required, and no files
53are added to your repository):
54
55	$ git-crypt export-key /path/to/key
56
57After cloning a repository with encrypted files, unlock with with GPG:
58
59	$ git-crypt unlock
60
61Or with a symmetric key:
62
63	$ git-crypt unlock /path/to/key
64
65That's all you need to do - after git-crypt is set up (either with
66`git-crypt init` or `git-crypt unlock`), you can use git normally -
67encryption and decryption happen transparently.
68
69
70CURRENT STATUS
71
72The latest version of git-crypt is 0.6.0, released on 2017-11-26.
73git-crypt aims to be bug-free and reliable, meaning it shouldn't
74crash, malfunction, or expose your confidential data.  However,
75it has not yet reached maturity, meaning it is not as documented,
76featureful, or easy-to-use as it should be.  Additionally, there may be
77backwards-incompatible changes introduced before version 1.0.
78
79
80SECURITY
81
82git-crypt is more secure than other transparent git encryption systems.
83git-crypt encrypts files using AES-256 in CTR mode with a synthetic IV
84derived from the SHA-1 HMAC of the file.  This mode of operation is
85provably semantically secure under deterministic chosen-plaintext attack.
86That means that although the encryption is deterministic (which is
87required so git can distinguish when a file has and hasn't changed),
88it leaks no information beyond whether two files are identical or not.
89Other proposals for transparent git encryption use ECB or CBC with a
90fixed IV.  These systems are not semantically secure and leak information.
91
92
93LIMITATIONS
94
95git-crypt relies on git filters, which were not designed with encryption
96in mind.  As such, git-crypt is not the best tool for encrypting most or
97all of the files in a repository. Where git-crypt really shines is where
98most of your repository is public, but you have a few files (perhaps
99private keys named *.key, or a file with API credentials) which you
100need to encrypt.  For encrypting an entire repository, consider using a
101system like git-remote-gcrypt <https://spwhitton.name/tech/code/git-remote-gcrypt/>
102instead.  (Note: no endorsement is made of git-remote-gcrypt's security.)
103
104git-crypt does not encrypt file names, commit messages, symlink targets,
105gitlinks, or other metadata.
106
107git-crypt does not hide when a file does or doesn't change, the length
108of a file, or the fact that two files are identical (see "Security"
109section above).
110
111Files encrypted with git-crypt are not compressible.  Even the smallest
112change to an encrypted file requires git to store the entire changed file,
113instead of just a delta.
114
115Although git-crypt protects individual file contents with a SHA-1
116HMAC, git-crypt cannot be used securely unless the entire repository is
117protected against tampering (an attacker who can mutate your repository
118can alter your .gitattributes file to disable encryption).  If necessary,
119use git features such as signed tags instead of relying solely on
120git-crypt for integrity.
121
122Files encrypted with git-crypt cannot be patched with git-apply, unless
123the patch itself is encrypted.  To generate an encrypted patch, use `git
124diff --no-textconv --binary`.  Alternatively, you can apply a plaintext
125patch outside of git using the patch command.
126
127git-crypt does not work reliably with some third-party git GUIs, such
128as Atlassian SourceTree <https://jira.atlassian.com/browse/SRCTREE-2511>
129and GitHub for Mac.  Files might be left in an unencrypted state.
130
131
132GITATTRIBUTES FILE
133
134The .gitattributes file is documented in the gitattributes(5) man page.
135The file pattern format is the same as the one used by .gitignore,
136as documented in the gitignore(5) man page, with the exception that
137specifying merely a directory (e.g. `/dir/`) is NOT sufficient to
138encrypt all files beneath it.
139
140Also note that the pattern `dir/*` does not match files under
141sub-directories of dir/.  To encrypt an entire sub-tree dir/, place the
142following in dir/.gitattributes:
143
144	* filter=git-crypt diff=git-crypt
145	.gitattributes !filter !diff
146
147The second pattern is essential for ensuring that .gitattributes itself
148is not encrypted.
149
150
151MAILING LISTS
152
153To stay abreast of, and provide input to, git-crypt development, consider
154subscribing to one or both of our mailing lists:
155
156Announcements: https://lists.cloudmutt.com/mailman/listinfo/git-crypt-announce
157Discussion:    https://lists.cloudmutt.com/mailman/listinfo/git-crypt-discuss
158

README.md

1git-crypt - transparent file encryption in git
2==============================================
3
4git-crypt enables transparent encryption and decryption of files in a
5git repository.  Files which you choose to protect are encrypted when
6committed, and decrypted when checked out.  git-crypt lets you freely
7share a repository containing a mix of public and private content.
8git-crypt gracefully degrades, so developers without the secret key can
9still clone and commit to a repository with encrypted files.  This lets
10you store your secret material (such as keys or passwords) in the same
11repository as your code, without requiring you to lock down your entire
12repository.
13
14git-crypt was written by [Andrew Ayer](https://www.agwa.name) (agwa@andrewayer.name).
15For more information, see <https://www.agwa.name/projects/git-crypt>.
16
17Building git-crypt
18------------------
19See the [INSTALL.md](INSTALL.md) file.
20
21
22Using git-crypt
23---------------
24
25Configure a repository to use git-crypt:
26
27    cd repo
28    git-crypt init
29
30Specify files to encrypt by creating a .gitattributes file:
31
32    secretfile filter=git-crypt diff=git-crypt
33    *.key filter=git-crypt diff=git-crypt
34
35Like a .gitignore file, it can match wildcards and should be checked into
36the repository.  See below for more information about .gitattributes.
37Make sure you don't accidentally encrypt the .gitattributes file itself
38(or other git files like .gitignore or .gitmodules).  Make sure your
39.gitattributes rules are in place *before* you add sensitive files, or
40those files won't be encrypted!
41
42Share the repository with others (or with yourself) using GPG:
43
44    git-crypt add-gpg-user USER_ID
45
46`USER_ID` can be a key ID, a full fingerprint, an email address, or
47anything else that uniquely identifies a public key to GPG (see "HOW TO
48SPECIFY A USER ID" in the gpg man page).  Note: `git-crypt add-gpg-user`
49will add and commit a GPG-encrypted key file in the .git-crypt directory
50of the root of your repository.
51
52Alternatively, you can export a symmetric secret key, which you must
53securely convey to collaborators (GPG is not required, and no files
54are added to your repository):
55
56    git-crypt export-key /path/to/key
57
58After cloning a repository with encrypted files, unlock with with GPG:
59
60    git-crypt unlock
61
62Or with a symmetric key:
63
64    git-crypt unlock /path/to/key
65
66That's all you need to do - after git-crypt is set up (either with
67`git-crypt init` or `git-crypt unlock`), you can use git normally -
68encryption and decryption happen transparently.
69
70Current Status
71--------------
72
73The latest version of git-crypt is [0.6.0](NEWS.md), released on
742017-11-26.  git-crypt aims to be bug-free and reliable, meaning it
75shouldn't crash, malfunction, or expose your confidential data.
76However, it has not yet reached maturity, meaning it is not as
77documented, featureful, or easy-to-use as it should be.  Additionally,
78there may be backwards-incompatible changes introduced before version
791.0.
80
81Security
82--------
83
84git-crypt is more secure than other transparent git encryption systems.
85git-crypt encrypts files using AES-256 in CTR mode with a synthetic IV
86derived from the SHA-1 HMAC of the file.  This mode of operation is
87provably semantically secure under deterministic chosen-plaintext attack.
88That means that although the encryption is deterministic (which is
89required so git can distinguish when a file has and hasn't changed),
90it leaks no information beyond whether two files are identical or not.
91Other proposals for transparent git encryption use ECB or CBC with a
92fixed IV.  These systems are not semantically secure and leak information.
93
94Limitations
95-----------
96
97git-crypt relies on git filters, which were not designed with encryption
98in mind.  As such, git-crypt is not the best tool for encrypting most or
99all of the files in a repository. Where git-crypt really shines is where
100most of your repository is public, but you have a few files (perhaps
101private keys named *.key, or a file with API credentials) which you
102need to encrypt.  For encrypting an entire repository, consider using a
103system like [git-remote-gcrypt](https://spwhitton.name/tech/code/git-remote-gcrypt/)
104instead.  (Note: no endorsement is made of git-remote-gcrypt's security.)
105
106git-crypt does not encrypt file names, commit messages, symlink targets,
107gitlinks, or other metadata.
108
109git-crypt does not hide when a file does or doesn't change, the length
110of a file, or the fact that two files are identical (see "Security"
111section above).
112
113Files encrypted with git-crypt are not compressible.  Even the smallest
114change to an encrypted file requires git to store the entire changed file,
115instead of just a delta.
116
117Although git-crypt protects individual file contents with a SHA-1
118HMAC, git-crypt cannot be used securely unless the entire repository is
119protected against tampering (an attacker who can mutate your repository
120can alter your .gitattributes file to disable encryption).  If necessary,
121use git features such as signed tags instead of relying solely on
122git-crypt for integrity.
123
124Files encrypted with git-crypt cannot be patched with git-apply, unless
125the patch itself is encrypted.  To generate an encrypted patch, use `git
126diff --no-textconv --binary`.  Alternatively, you can apply a plaintext
127patch outside of git using the patch command.
128
129git-crypt does not work reliably with some third-party git GUIs, such
130as [Atlassian SourceTree](https://jira.atlassian.com/browse/SRCTREE-2511)
131and GitHub for Mac.  Files might be left in an unencrypted state.
132
133Gitattributes File
134------------------
135
136The .gitattributes file is documented in the gitattributes(5) man page.
137The file pattern format is the same as the one used by .gitignore,
138as documented in the gitignore(5) man page, with the exception that
139specifying merely a directory (e.g. `/dir/`) is *not* sufficient to
140encrypt all files beneath it.
141
142Also note that the pattern `dir/*` does not match files under
143sub-directories of dir/.  To encrypt an entire sub-tree dir/, place the
144following in dir/.gitattributes:
145
146    * filter=git-crypt diff=git-crypt
147    .gitattributes !filter !diff
148
149The second pattern is essential for ensuring that .gitattributes itself
150is not encrypted.
151
152Mailing Lists
153-------------
154
155To stay abreast of, and provide input to, git-crypt development,
156consider subscribing to one or both of our mailing lists:
157
158* [Announcements](https://lists.cloudmutt.com/mailman/listinfo/git-crypt-announce)
159* [Discussion](https://lists.cloudmutt.com/mailman/listinfo/git-crypt-discuss)
160