mirror of
https://github.com/AGWA/git-crypt.git
synced 2026-01-11 12:45:49 -08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
849401d733 | ||
|
|
12881f65fd | ||
|
|
280bd43ac7 | ||
|
|
b7c608da25 | ||
|
|
9cb1ad3c33 | ||
|
|
1b1715b5ec |
2
Makefile
2
Makefile
@@ -25,7 +25,7 @@ util.o: util.cpp util-unix.cpp util-win32.cpp
|
|||||||
clean:
|
clean:
|
||||||
rm -f *.o git-crypt
|
rm -f *.o git-crypt
|
||||||
|
|
||||||
install:
|
install: git-crypt
|
||||||
install -m 755 git-crypt $(DESTDIR)$(PREFIX)/bin/
|
install -m 755 git-crypt $(DESTDIR)$(PREFIX)/bin/
|
||||||
|
|
||||||
.PHONY: all clean install
|
.PHONY: all clean install
|
||||||
|
|||||||
5
NEWS
5
NEWS
@@ -1,3 +1,8 @@
|
|||||||
|
v0.4.1 (2015-01-08)
|
||||||
|
* Important usability fix to ensure that the .git-crypt directory
|
||||||
|
can't be encrypted by accident (see RELEASE_NOTES-0.4.1.md for
|
||||||
|
more information).
|
||||||
|
|
||||||
v0.4 (2014-11-16)
|
v0.4 (2014-11-16)
|
||||||
(See RELEASE_NOTES-0.4.md for important details.)
|
(See RELEASE_NOTES-0.4.md for important details.)
|
||||||
* Add optional GPG support: GPG can be used to share the repository
|
* Add optional GPG support: GPG can be used to share the repository
|
||||||
|
|||||||
5
NEWS.md
5
NEWS.md
@@ -1,6 +1,11 @@
|
|||||||
News
|
News
|
||||||
====
|
====
|
||||||
|
|
||||||
|
######v0.4.1 (2015-01-08)
|
||||||
|
* Important usability fix to ensure that the .git-crypt directory
|
||||||
|
can't be encrypted by accident (see
|
||||||
|
[the release notes](RELEASE_NOTES-0.4.1.md) for more information).
|
||||||
|
|
||||||
######v0.4 (2014-11-16)
|
######v0.4 (2014-11-16)
|
||||||
(See [the release notes](RELEASE_NOTES-0.4.md) for important details.)
|
(See [the release notes](RELEASE_NOTES-0.4.md) for important details.)
|
||||||
* Add optional GPG support: GPG can be used to share the repository
|
* Add optional GPG support: GPG can be used to share the repository
|
||||||
|
|||||||
6
README
6
README
@@ -66,7 +66,7 @@ encryption and decryption happen transparently.
|
|||||||
|
|
||||||
CURRENT STATUS
|
CURRENT STATUS
|
||||||
|
|
||||||
The latest version of git-crypt is 0.4, released on 2014-11-16.
|
The latest version of git-crypt is 0.4.1, released on 2015-01-08.
|
||||||
git-crypt aims to be bug-free and reliable, meaning it shouldn't
|
git-crypt aims to be bug-free and reliable, meaning it shouldn't
|
||||||
crash, malfunction, or expose your confidential data. However,
|
crash, malfunction, or expose your confidential data. However,
|
||||||
it has not yet reached maturity, meaning it is not as documented,
|
it has not yet reached maturity, meaning it is not as documented,
|
||||||
@@ -145,5 +145,5 @@ MAILING LISTS
|
|||||||
To stay abreast of, and provide input to, git-crypt development, consider
|
To stay abreast of, and provide input to, git-crypt development, consider
|
||||||
subscribing to one or both of our mailing lists:
|
subscribing to one or both of our mailing lists:
|
||||||
|
|
||||||
Announcements: http://lists.cloudmutt.com/mailman/listinfo/git-crypt-announce
|
Announcements: https://lists.cloudmutt.com/mailman/listinfo/git-crypt-announce
|
||||||
Discussion: http://lists.cloudmutt.com/mailman/listinfo/git-crypt-discuss
|
Discussion: https://lists.cloudmutt.com/mailman/listinfo/git-crypt-discuss
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ encryption and decryption happen transparently.
|
|||||||
Current Status
|
Current Status
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
The latest version of git-crypt is [0.4](RELEASE_NOTES-0.4.md), released on
|
The latest version of git-crypt is [0.4.1](RELEASE_NOTES-0.4.1.md), released on
|
||||||
2014-11-16. git-crypt aims to be bug-free and reliable, meaning it
|
2015-01-08. git-crypt aims to be bug-free and reliable, meaning it
|
||||||
shouldn't crash, malfunction, or expose your confidential data.
|
shouldn't crash, malfunction, or expose your confidential data.
|
||||||
However, it has not yet reached maturity, meaning it is not as
|
However, it has not yet reached maturity, meaning it is not as
|
||||||
documented, featureful, or easy-to-use as it should be. Additionally,
|
documented, featureful, or easy-to-use as it should be. Additionally,
|
||||||
@@ -147,5 +147,5 @@ Mailing Lists
|
|||||||
To stay abreast of, and provide input to, git-crypt development,
|
To stay abreast of, and provide input to, git-crypt development,
|
||||||
consider subscribing to one or both of our mailing lists:
|
consider subscribing to one or both of our mailing lists:
|
||||||
|
|
||||||
* [Announcements](http://lists.cloudmutt.com/mailman/listinfo/git-crypt-announce)
|
* [Announcements](https://lists.cloudmutt.com/mailman/listinfo/git-crypt-announce)
|
||||||
* [Discussion](http://lists.cloudmutt.com/mailman/listinfo/git-crypt-discuss)
|
* [Discussion](https://lists.cloudmutt.com/mailman/listinfo/git-crypt-discuss)
|
||||||
|
|||||||
21
RELEASE_NOTES-0.4.1.md
Normal file
21
RELEASE_NOTES-0.4.1.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
git-crypt 0.4.1 is a bugfix-only release that contains an important
|
||||||
|
usability fix for users who use GPG mode to encrypt an entire repository.
|
||||||
|
|
||||||
|
Previously, if you used a '*' pattern in the top-level .gitattributes
|
||||||
|
file, and you did not explicitly add a pattern to exclude the .git-crypt
|
||||||
|
directory, the files contained therein would be encrypted, rendering
|
||||||
|
the repository impossible to unlock with GPG.
|
||||||
|
|
||||||
|
git-crypt now adds a .gitattributes file to the .git-crypt directory
|
||||||
|
to prevent its contents from being encrypted, regardless of patterns in
|
||||||
|
the top-level .gitattributes.
|
||||||
|
|
||||||
|
If you are using git-crypt in GPG mode to encrypt an entire repository,
|
||||||
|
and you do not already have a .gitattributes pattern to exclude the
|
||||||
|
.git-crypt directory, you are strongly advised to upgrade. After
|
||||||
|
upgrading, you should do the following in each of your repositories to
|
||||||
|
ensure that the information inside .git-crypt is properly stored:
|
||||||
|
|
||||||
|
1. Remove existing key files: `rm .git-crypt/keys/*/0/*`
|
||||||
|
|
||||||
|
2. Re-add GPG user(s): `git-crypt add-gpg-user GPG_USER_ID ...`
|
||||||
45
commands.cpp
45
commands.cpp
@@ -146,7 +146,7 @@ static void validate_key_name_or_throw (const char* key_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string get_internal_keys_path ()
|
static std::string get_internal_state_path ()
|
||||||
{
|
{
|
||||||
// git rev-parse --git-dir
|
// git rev-parse --git-dir
|
||||||
std::vector<std::string> command;
|
std::vector<std::string> command;
|
||||||
@@ -162,11 +162,21 @@ static std::string get_internal_keys_path ()
|
|||||||
|
|
||||||
std::string path;
|
std::string path;
|
||||||
std::getline(output, path);
|
std::getline(output, path);
|
||||||
path += "/git-crypt/keys";
|
path += "/git-crypt";
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string get_internal_keys_path (const std::string& internal_state_path)
|
||||||
|
{
|
||||||
|
return internal_state_path + "/keys";
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string get_internal_keys_path ()
|
||||||
|
{
|
||||||
|
return get_internal_keys_path(get_internal_state_path());
|
||||||
|
}
|
||||||
|
|
||||||
static std::string get_internal_key_path (const char* key_name)
|
static std::string get_internal_key_path (const char* key_name)
|
||||||
{
|
{
|
||||||
std::string path(get_internal_keys_path());
|
std::string path(get_internal_keys_path());
|
||||||
@@ -176,7 +186,7 @@ static std::string get_internal_key_path (const char* key_name)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string get_repo_keys_path ()
|
static std::string get_repo_state_path ()
|
||||||
{
|
{
|
||||||
// git rev-parse --show-toplevel
|
// git rev-parse --show-toplevel
|
||||||
std::vector<std::string> command;
|
std::vector<std::string> command;
|
||||||
@@ -198,10 +208,20 @@ static std::string get_repo_keys_path ()
|
|||||||
throw Error("Could not determine Git working tree - is this a non-bare repo?");
|
throw Error("Could not determine Git working tree - is this a non-bare repo?");
|
||||||
}
|
}
|
||||||
|
|
||||||
path += "/.git-crypt/keys";
|
path += "/.git-crypt";
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string get_repo_keys_path (const std::string& repo_state_path)
|
||||||
|
{
|
||||||
|
return repo_state_path + "/keys";
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string get_repo_keys_path ()
|
||||||
|
{
|
||||||
|
return get_repo_keys_path(get_repo_state_path());
|
||||||
|
}
|
||||||
|
|
||||||
static std::string get_path_to_top ()
|
static std::string get_path_to_top ()
|
||||||
{
|
{
|
||||||
// git rev-parse --show-cdup
|
// git rev-parse --show-cdup
|
||||||
@@ -1015,10 +1035,23 @@ int add_gpg_user (int argc, const char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string keys_path(get_repo_keys_path());
|
const std::string state_path(get_repo_state_path());
|
||||||
std::vector<std::string> new_files;
|
std::vector<std::string> new_files;
|
||||||
|
|
||||||
encrypt_repo_key(key_name, *key, collab_keys, keys_path, &new_files);
|
encrypt_repo_key(key_name, *key, collab_keys, get_repo_keys_path(state_path), &new_files);
|
||||||
|
|
||||||
|
// Add a .gitatributes file to the repo state directory to prevent files in it from being encrypted.
|
||||||
|
const std::string state_gitattributes_path(state_path + "/.gitattributes");
|
||||||
|
if (access(state_gitattributes_path.c_str(), F_OK) != 0) {
|
||||||
|
std::ofstream state_gitattributes_file(state_gitattributes_path.c_str());
|
||||||
|
state_gitattributes_file << "* !filter !diff\n";
|
||||||
|
state_gitattributes_file.close();
|
||||||
|
if (!state_gitattributes_file) {
|
||||||
|
std::clog << "Error: unable to write " << state_gitattributes_path << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
new_files.push_back(state_gitattributes_path);
|
||||||
|
}
|
||||||
|
|
||||||
// add/commit the new files
|
// add/commit the new files
|
||||||
if (!new_files.empty()) {
|
if (!new_files.empty()) {
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ static void print_usage (std::ostream& out)
|
|||||||
out << "See 'git-crypt help COMMAND' for more information on a specific command." << std::endl;
|
out << "See 'git-crypt help COMMAND' for more information on a specific command." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_version (std::ostream& out)
|
||||||
|
{
|
||||||
|
out << "git-crypt " << VERSION << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
static bool help_for_command (const char* command, std::ostream& out)
|
static bool help_for_command (const char* command, std::ostream& out)
|
||||||
{
|
{
|
||||||
if (std::strcmp(command, "init") == 0) {
|
if (std::strcmp(command, "init") == 0) {
|
||||||
@@ -121,6 +126,12 @@ static int help (int argc, const char** argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int version (int argc, const char** argv)
|
||||||
|
{
|
||||||
|
print_version(std::cout);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main (int argc, const char** argv)
|
int main (int argc, const char** argv)
|
||||||
try {
|
try {
|
||||||
@@ -141,6 +152,9 @@ try {
|
|||||||
if (std::strcmp(argv[arg_index], "--help") == 0) {
|
if (std::strcmp(argv[arg_index], "--help") == 0) {
|
||||||
print_usage(std::clog);
|
print_usage(std::clog);
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (std::strcmp(argv[arg_index], "--version") == 0) {
|
||||||
|
print_version(std::clog);
|
||||||
|
return 0;
|
||||||
} else if (std::strcmp(argv[arg_index], "--") == 0) {
|
} else if (std::strcmp(argv[arg_index], "--") == 0) {
|
||||||
++arg_index;
|
++arg_index;
|
||||||
break;
|
break;
|
||||||
@@ -171,6 +185,9 @@ try {
|
|||||||
if (std::strcmp(command, "help") == 0) {
|
if (std::strcmp(command, "help") == 0) {
|
||||||
return help(argc, argv);
|
return help(argc, argv);
|
||||||
}
|
}
|
||||||
|
if (std::strcmp(command, "version") == 0) {
|
||||||
|
return version(argc, argv);
|
||||||
|
}
|
||||||
if (std::strcmp(command, "init") == 0) {
|
if (std::strcmp(command, "init") == 0) {
|
||||||
return init(argc, argv);
|
return init(argc, argv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#ifndef GIT_CRYPT_GIT_CRYPT_HPP
|
#ifndef GIT_CRYPT_GIT_CRYPT_HPP
|
||||||
#define GIT_CRYPT_GIT_CRYPT_HPP
|
#define GIT_CRYPT_GIT_CRYPT_HPP
|
||||||
|
|
||||||
|
#define VERSION "0.4.1"
|
||||||
|
|
||||||
extern const char* argv0; // initialized in main() to argv[0]
|
extern const char* argv0; // initialized in main() to argv[0]
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user