Wondering how I can get rid of the annoying error message that gets displayed, yet doesnt seem to cause a problem when running gpg.

The error message is

can't connect to `/tmp/gpg-LxFX7Q/S.gpg-agent': No such file or directory
can't connect to `/home/user/.gnupg/S.gpg-agent': No such file or directory

I had a hell of a time just getting gpg to work over ssh, but now that it seems to work and I can use the cli version of pinentry and I dont like how ive done it so Im open to better suggestions. But now I am getting the above errors when running gpg.

Essentially I found a mishmash of various “solutions” to getting gpg to work without X over ssh, I know its not right but I couldnt find better solutions.

I added the following line to my .profile (yes this causes a new instance of gpg-agent to be spawned each time I log in but I couldnt find where gpg-agent.conf is)

gpg-agent --daemon --enable-ssh-support --write-env-file "${HOME}/.gnupg/"

Then in my .bashrc I added the following lines

if  -f "${HOME}/.gnupg/" ]; then
        . "${HOME}/.gnupg/"
        export GPG_AGENT_INFO
        export SSH_AUTH_SOCK
        export SSH_AGENT_PID

export GPG_TTY

Does anyone know a better way to make gpg work correctly over ssh or in an X-less environment? Can I simply disable gpg-agent and pinentry to have gpg fail back to its own cli interface for entering the pin? I understand why the agent is involved, however I simply use gpg as a standalone cli program for (de|en)crypting files so the purposes of the agent arent needed since im not using it in conjunction with other applications.