Skip to content

Commit dae273e

Browse files
Update telling-git-about-your-signing-key.md (#4609)
* Update telling-git-about-your-signing-key.md * Update content/github/authenticating-to-github/telling-git-about-your-signing-key.md Co-authored-by: hubwriter <hubwriter@github.com> * Update content/github/authenticating-to-github/telling-git-about-your-signing-key.md Co-authored-by: hubwriter <hubwriter@github.com> * Give alternatives for Mac using zsh and bash I've also modified the commands so that .zprofile (or .profile) is only modified if .zshrc (or .bash_profile) doesn't exist. * Update content/github/authenticating-to-github/telling-git-about-your-signing-key.md * Update content/github/authenticating-to-github/telling-git-about-your-signing-key.md * Update content/github/authenticating-to-github/telling-git-about-your-signing-key.md Co-authored-by: hubwriter <hubwriter@github.com>
1 parent 33ff951 commit dae273e

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

content/github/authenticating-to-github/telling-git-about-your-signing-key.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ If you have multiple GPG keys, you need to tell Git which one to use.
3131
{% data reusables.gpg.list-keys-with-note %}
3232
{% data reusables.gpg.copy-gpg-key-id %}
3333
{% data reusables.gpg.paste-gpg-key-id %}
34-
1. If you aren't using the GPG suite, paste the text below to add the GPG key to your bash profile:
34+
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:
3535
```shell
36-
$ test -r ~/.bash_profile && echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile
37-
$ echo 'export GPG_TTY=$(tty)' >> ~/.profile
36+
$ if [ -r ~/.zshrc ]; then echo 'export GPG_TTY=$(tty)' >> ~/.zshrc; \
37+
else echo 'export GPG_TTY=$(tty)' >> ~/.zprofile; fi
38+
```
39+
Alternatively, if you use the `bash` shell, run this command:
40+
```shell
41+
$ if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \
42+
else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
3843
```
39-
{% note %}
40-
41-
**Note:** If you don't have `.bash_profile`, this command adds your GPG key to `.profile`.
42-
43-
{% endnote %}
4444

4545
{% data reusables.gpg.x-509-key %}
4646

@@ -93,10 +93,10 @@ If you have multiple GPG keys, you need to tell Git which one to use.
9393
{% data reusables.gpg.list-keys-with-note %}
9494
{% data reusables.gpg.copy-gpg-key-id %}
9595
{% data reusables.gpg.paste-gpg-key-id %}
96-
1. To add your GPG key to your bash profile, paste the text below:
96+
1. To add your GPG key to your bash profile, run the following command:
9797
```shell
98-
$ test -r ~/.bash_profile && echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile
99-
$ echo 'export GPG_TTY=$(tty)' >> ~/.profile
98+
$ if [ -r ~/.bash_profile ]; then echo 'export GPG_TTY=$(tty)' >> ~/.bash_profile; \
99+
else echo 'export GPG_TTY=$(tty)' >> ~/.profile; fi
100100
```
101101
{% note %}
102102

0 commit comments

Comments
 (0)