Page 1 of 1

Question about .bashrc and tty

PostPosted: Oct 7th, '24, 23:25
by Spinnifex
Hello.

I want to configure my github account so sign my software commits
with my gpg key.
What I not understand is what this
Code: Select all
[ -f ~/.bashrc ] && echo -e '\nexport GPG_TTY=$(tty)' >> ~/.bashrc

does. And why I should use this.
This was explained here.
But not why I should do this.

As I understand this we tell the system that any command which want to talk to gpg on a terminal should use the
terminal found on
Code: Select all
$(tty)


I did something simillar on my .bash_profile file.
There I have the following
Code: Select all
GPG_TTY=$(tty)
export GPG_TTY
unset USERNAME


but when i call
Code: Select all
echo $GPG_TTY

I get
Code: Select all
Kein Terminal

Is this okay?

Btw. what does
Code: Select all
unset USERNAME

regards
Spinni