Closed scolby33 closed 4 years ago
I have found the solution! Using the GIT_DIR
and GIT_WORK_TREE
environment variables, git-crypt is able to find the proper directories. I hope this will help someone else who has to search for this problem.
I did it slightly differently, so maybe this helps too.
I have a bare repository which I use via an alias in my .bashrc
:
alias config='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
Since you can use git crypt init
etc. instead of git-crypt init
, I was thus able to set things up via
config crypt init
config crypt add-gpg-user <my-id>
I put the .gitattributes
into $HOME by the way, since this was the path shown by config rev-parse --show-toplevel
.
@scolby33 thanks a lot!
Running this command line within GIT_WORK_TREE made file decrypted.
GIT_DIR=/var/repo/api.git/ GIT_WORK_TREE=/var/www/api git-crypt unlock /etc/whatever/crypt.key
Is it possible to use git-crypt with a bare repo? I was able to successfully
git-crypt init
by cd-ing into the .git directory for the bare repo but I am unable togit-crypt add-gpg-user
. This is due to the error thrown here: https://github.com/AGWA/git-crypt/blob/master/commands.cpp#L298In the following lines I see parsing of the git config. Would it be possible to add
git-crypt.topLevel
or a similar value to bypass the call togit rev-parse --top-level
? Would there be other obstacles to using git-crypt with a bare repo other than this particular function?