Skip to content

git-stack picks up a wrong GPG key for signing commits #286

@bemyak

Description

@bemyak

Please complete the following tasks

  • I have searched the discussions
  • I have searched the existing issues

Description

Git-stack picks up the first GPG key to sign commits.

I have a set of GPG keys set up in the following order (gpg --list-secret-keys --keyid-format LONG):

  1. old-work@email.com (an email left from the previous job, not mentioned in any git configs or env vars)
  2. private@email.com
  3. work@email.com

Whenever I run git sync, it always tries to sign commits with the first key from the list (i.e. old-work@email.com).

Version

0.10.10

Steps to reproduce

  1. Run gpg --full-generate-key multiple times to create a couple of GPG keys. To make testing easier, I recommend setting different passphrases for them.
    1. email1@email.com
    2. email2@email.com
    3. email3@email.com
  2. Set git email to email2@email.com: git config --global user.email "email2@email.com"
  3. Force git to sign all commits: git config --global commit.gpgSign true
  4. Set env variables to email3@email.com:
    1. export GIT_AUTHOR_EMAIL=email3@email.com
    2. export GIT_COMMITTER_EMAIL=email3@email.com
  5. Run git sync in any repo that will require rebasing and resigning commits

Actual Behaviour

Git-sync signs commits with email1@email.com key

Expected Behaviour

Git-sync should pick up a key in the following priority:

  • GIT_COMMITTER_EMAIL
  • ~/.config/git/config
  • ~/.gitconfig

Debug Output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugNot as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions