From d0d1fa42f553e764e23d9035fd3b995693e65ecd Mon Sep 17 00:00:00 2001 From: Raza <42661870+AlmostEfficient@users.noreply.github.com> Date: Sat, 27 May 2023 13:42:50 +1200 Subject: [PATCH 1/2] Refactor export GPG_TTY command to add line break The command to add `GPG_TTY` does not update the shell config correctly if the file ends in a comment. I previously installed pnpm so running the command changed my `.zshrc` file to: ``` #pnpm endexport GPG_TTY=$(tty) ``` Fixed by updating each instance of the command to: ``` echo -e '\nexport GPG_TTY=\$(tty)' ``` --- .../telling-git-about-your-signing-key.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md b/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md index 5dbc6173bb72..e2b41f01a67d 100644 --- a/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md +++ b/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md @@ -39,13 +39,13 @@ If you have multiple GPG keys, you need to tell Git which one to use. {% data reusables.gpg.set-auto-sign %} 1. If you aren't using the GPG suite, run the following command in the `zsh` shell to add the GPG key to your `.zshrc` file, if it exists, or your `.zprofile` file: ```shell - $ if [ -r ~/.zshrc ]; then echo 'export GPG_TTY=$(tty)' >> ~/.zshrc; \ - else echo 'export GPG_TTY=$(tty)' >> ~/.zprofile; fi + $ if [ -r ~/.zshrc ]; then echo -e '\nexport GPG_TTY=\$(tty)' >> ~/.zshrc; \ + else echo -e '\nexport GPG_TTY=\$(tty)' >> ~/.zprofile; fi ``` Alternatively, if you use the `bash` shell, run this command: ```shell - $ if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \ - else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi + $ if [ -r ~/.bash_profile ]; then echo -e '\nexport GPG_TTY=\$(tty)' >> ~/.bash_profile; \ + else echo -e '\nexport GPG_TTY=\$(tty)' >> ~/.profile; fi ``` 1. Optionally, to prompt you to enter a PIN or passphrase when required, install `pinentry-mac`. For example, using [Homebrew](https://brew.sh/): ```shell @@ -97,7 +97,7 @@ If you have multiple GPG keys, you need to tell Git which one to use. {% data reusables.gpg.set-auto-sign %} 1. To add your GPG key to your `.bashrc` startup file, run the following command: ```bash - $ [ -f ~/.bashrc ] && echo 'export GPG_TTY=$(tty)' >> ~/.bashrc + $ [ -f ~/.bashrc ] && echo -e '\nexport GPG_TTY=\$(tty)' >> ~/.bashrc ``` {% endlinux %} {% ifversion ssh-commit-verification %} From b42173e6752d8ccd8ddb9da53ac02c575f389795 Mon Sep 17 00:00:00 2001 From: Sarah Edwards Date: Fri, 2 Jun 2023 11:29:29 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- .../telling-git-about-your-signing-key.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md b/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md index 33e91ef3196b..c652a144af28 100644 --- a/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md +++ b/content/authentication/managing-commit-signature-verification/telling-git-about-your-signing-key.md @@ -99,9 +99,6 @@ If you have multiple GPG keys, you need to tell Git which one to use. ```bash $ [ -f ~/.bashrc ] && echo -e '\nexport GPG_TTY=\$(tty)' >> ~/.bashrc ``` - ```bash - $ [ -f ~/.bashrc ] && echo 'export GPG_TTY=$(tty)' >> ~/.bashrc - ``` {% endlinux %} {% ifversion ssh-commit-verification %}