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 option for GCM_GPG_PATH environment variable (Linux-only) #406

Merged
merged 1 commit into from
Aug 10, 2021

Conversation

vdye
Copy link
Contributor

@vdye vdye commented Aug 9, 2021

Fixes #356.

Changes

  • Add support for GCM_GPG_PATH environment variable, used as location of GPG executable if specified (if specified but invalid, exception thrown)
  • Updated logic to find GPG executable if explicit path not specified (meant to match behavior in pass, see here)
    • If gpg2 exists, use that; otherwise, use gpg

Testing

  • when GCM_GPG_PATH is not set or set to valid GPG executable, GPG is found without error
  • when GCM_GPG_PATH is set to "nonsense" (or some other non-file), receive the following error for any git-credential-manager invocation:
    Unhandled exception. System.Exception: GPG executable does not exist with path 'nonsense'
     at Microsoft.Git.CredentialManager.CommandContext.GetGpgPath(IEnvironment environment, IFileSystem fileSystem)
     at Microsoft.Git.CredentialManager.CommandContext..ctor(String appPath)  
     at Microsoft.Git.CredentialManager.Program.Main(String[] args)
    

Copy link
Collaborator

@mjcheetham mjcheetham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few comments on the wording of the documentation, and a suggestion to add tracing of the resolved GPG path.

docs/environment.md Outdated Show resolved Hide resolved
docs/environment.md Outdated Show resolved Hide resolved
@mjcheetham
Copy link
Collaborator

By the way you might want to rebase this work on the latest main branch that includes a workaround for the flakey test.

@vdye vdye force-pushed the 356-manually-specify-gpg-path branch 2 times, most recently from 55eab5e to d3f82bc Compare August 10, 2021 12:53
If GCM_GPG_PATH is specified, it is assumed to be the path to the GPG
executable used by `pass` and will throw an exception if it is not found.
If GCM_GPG_PATH is _not_ specified, GCM Core will attempt to find the
correct GPG executable by mimicking the behavior (currently) used by `pass`
(that is, first searching for `gpg2`, then falling back on `gpg` if `gpg2` is
not found).
@vdye vdye force-pushed the 356-manually-specify-gpg-path branch from d3f82bc to ddcab81 Compare August 10, 2021 12:56
@mjcheetham mjcheetham merged commit be49480 into git-ecosystem:main Aug 10, 2021
@vdye vdye deleted the 356-manually-specify-gpg-path branch August 10, 2021 13:51
@mjcheetham mjcheetham mentioned this pull request Aug 11, 2021
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.

Allow gpg path to be manually configured to make sure gpg2 is used
2 participants