Multiple Git subdirectories for different environments

Grégoire Détrez gregoire at fripost.org
Thu Jan 12 13:38:28 CET 2017


Hi Todd,

On Wed, Jan 11, 2017 at 12:00:56PM -0500, Todd A. Jacobs wrote:
> I've been thinking about how pass currently implements Git, and wondering
> how one is intended to use subdirectories to divide up passwords. By
> default, pass doesn't really do any Git initializations; it seems to simply
> check whether PASSWORD_STORE_DIR is a Git directory.
> 
> I see an option for PASSWORD_STORE_GIT, but there's no real example of how
> that's meant to be used. In addition, I suppose one could always use
> submodules or subtree merging to keep segments of the store separate, but
> again I don't see specific examples of how this is meant to be implemented
> effectively.
> 
> What's the best practice if one wants to have separate sub-stores for
> different work environments, where only the relevant subdirectories are
> pulled in by Git?

I'm not completely sure I understand what you want to do but I think you
can achieve something like this using PASSWORD_STORE_GIT and
PASSWORD_STORE_DIR together.

Assuming you have the following structure in your repository:
.password-store
├── home
│   └── foo.gpg
└── work
    └── foo.gpg

with

    $ pass home/foo
    1234
    $ pass work/foo
    4321

Then you can do set the environment variables like this:

    $ export PASSWORD_STORE_GIT=~/.password-store
    $ export PASSWORD_STORE_DIR=~/.password-store/home
    $ pass foo
    1234
    $ export PASSWORD_STORE_DIR=~/.password-store/work
    $ pass foo
    4321

I hope it helps!

/ǵ
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20170112/72a97ec9/attachment.asc>


More information about the Password-Store mailing list