Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git-crypt merge driver to support secret files merging. #107

Closed
wants to merge 2 commits into from

Conversation

shlomosh
Copy link

Add git-crypt merge driver to support secret files merging.

Update clean operation to not alter output when it run multiple times, to match recommended behaviour (https://git-scm.com/docs/gitattributes) -

For best results, clean should not alter its output further if it is run twice ("clean→clean" should be equivalent to "clean"), and multiple smudge commands should not alter clean's output ("smudge→smudge→clean" should be equivalent to "clean"). See the section on merging below.

Shlomo Shachar added 2 commits January 23, 2017 17:50
…anded by git .gitattribute documentation. Add git-crypt merge driver to support secret files merging.
@ahawkins
Copy link

ahawkins commented May 17, 2017

Any movement on this PR? I just got hit by the unfortunate UX while rebasing/merging. This may fix it right?

@shlomosh should this make merge and rebase work like it does with every other file?

@tobiasBora
Copy link

I tried this pr, but it did not solve this issue, any idea why? #140

@Quentin-M
Copy link

git-crypt is basically unusable without this. Is there any reason @AGWA @shlomosh this never has been merged?

@peay
Copy link

peay commented Jan 24, 2019

@AGWA any chance this would get merged in?

@amoffat
Copy link

amoffat commented Mar 22, 2019

I love git-crypt, but encrypting config files is a nightmare due to the inability to merge changes. Just vocalizing my support for a feature that fixes that.

@alerque
Copy link
Contributor

alerque commented Mar 23, 2019

I am along time git-crypt user, and I just started a batch of projects that I'm going to need merge for! To date I've either used it for protecting very private personal stuff in semi-private repos where I'm the only major committer and used a flat master branch, or kept secrets like deploy keys that don't typically need merging.

For the new projects I'm looking at keeping significant amounts of content that will be edited in parallel where half of it is copyrighted and half of it will be public. Rather than just making CI builds public I'd like to make the entire repository public and just lock down the files that are for some-eyes-only. If git-crypt could handle edited files being merged back and fourth it would be ideal for this scenario.

@alerque
Copy link
Contributor

alerque commented Mar 23, 2019

@amoffat Just a tip: The best architecture I've found for this is to split config files into private and public bits. Most of the time 95% of the content of config files can be unencrypted, usually only a few keys are sensitive (deploy keys, passwords, private URLs, etc.). Often there is a way to import files so that you can put just the one or two sensitive keys in an encrypted file and import it into the unencrypted config. You can often even do this programatically to set different values if the encrypted versions are not available.

In the cases where the native config syntax doesn't have a way to handle this it's usually trivial to make merging the sources part of a build or init script.

@krish7919
Copy link
Contributor

You can do something similar with the https://github.com/krish7919/git-crypt-merge-tool (disclaimer, I wrote it).

Our use-case is to encrypt a file that is changed on probably every commit we make to the repo, and it works just fine.

@Quentin-M
Copy link

Quentin-M commented Mar 24, 2019 via email

@AGWA
Copy link
Owner

AGWA commented May 2, 2019

I'm curious why this PR has changed clean to pass through the file if it's already encrypted. Shouldn't the file always be decrypted, since it was passed through smudge prior to running git merge-file? Note that the proposal in #141 doesn't do this.

jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
As recommended by gitattributes(5):

> For best results, clean should not alter its output further if it is
> run twice ("clean->clean" should be equivalent to "clean"), and
> multiple smudge commands should not alter clean's output
> ("smudge->smudge->clean" should be equivalent to "clean").

I've extracted this change from AGWA#107.

Co-Authored-By: Shlomo Shachar <[email protected]>
jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
As recommended by gitattributes(5):

> For best results, clean should not alter its output further if it is
> run twice ("clean->clean" should be equivalent to "clean"), and
> multiple smudge commands should not alter clean's output
> ("smudge->smudge->clean" should be equivalent to "clean").

I've extracted this change from AGWA#107.

Co-Authored-By: obiasBora <[email protected]>
jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
As recommended by gitattributes(5):

> For best results, clean should not alter its output further if it is
> run twice ("clean->clean" should be equivalent to "clean"), and
> multiple smudge commands should not alter clean's output
> ("smudge->smudge->clean" should be equivalent to "clean").

I've extracted this change from AGWA#107.

Co-Authored-By: shlomosh <[email protected]>
jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
As recommended by gitattributes(5):

> For best results, clean should not alter its output further if it is
> run twice ("clean->clean" should be equivalent to "clean"), and
> multiple smudge commands should not alter clean's output
> ("smudge->smudge->clean" should be equivalent to "clean").

I've extracted this change from AGWA#107.

Co-Authored-By: Shlomo Shachar <[email protected]>
jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
As recommended by gitattributes(5):

> For best results, clean should not alter its output further if it is
> run twice ("clean->clean" should be equivalent to "clean"), and
> multiple smudge commands should not alter clean's output
> ("smudge->smudge->clean" should be equivalent to "clean").

I've extracted this change from AGWA#107.

Co-Authored-By: Shlomo Shachar <[email protected]>
jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
This is a preparation for the merge command.

I've extracted this change from AGWA#107.

Co-Authored-By: Shlomo Shachar <[email protected]>
jirutka added a commit to jirutka/git-crypt that referenced this pull request Jul 28, 2019
This commit is based on AGWA#107.

Co-Authored-By: Shlomo Shachar <[email protected]>
@AGWA
Copy link
Owner

AGWA commented Jul 28, 2020

Superseded by #180.

@AGWA AGWA closed this Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants