abhaybd / GitID

Command-line tool for managing multiple git identities on the same machine
https://pypi.org/project/gitid/
MIT License
1 stars 0 forks source link

Support for pgp signing key #1

Open PierrePaul opened 1 week ago

PierrePaul commented 1 week ago

Thanks for GitID! :)

I was wondering if it would be possible to add support for signing key? Looking at the code, GitID works by setting envs vars, but as far as I know, there's no env var for the signing key itself.

There's always the possibility of calling git config set directly, but I'm thinking it could be overwritten by any .git/config set per project, which would defeat the purpose of GitID.

In any case, I would like to hear your thoughts and I would be happy to contribute to the task as well.

Thanks!

abhaybd commented 6 days ago

Thanks for your interest in this project!

I personally don't use commit signing so I haven't bumped into this issue in the past, but I can see how that would be a very useful addition. As you noted, git doesn't use environment variables for setting the signing key, which makes it annoying.

Maybe GitID could overwrite the local config using git config set to force git to use the given key, and then restore the previous key when the session ends, using something like trap? Overwriting the local config instead of global would allow for concurrent users as long as they're in different projects, which makes sense.

It's not the cleanest solution, so I'm curious if you have any better ideas. I'm happy to review any PRs that could add this feature!