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

emacs - ii-reload-ssh-agent #20

Open
hh opened this issue Apr 10, 2024 · 1 comment
Open

emacs - ii-reload-ssh-agent #20

hh opened this issue Apr 10, 2024 · 1 comment

Comments

@hh
Copy link
Member

hh commented Apr 10, 2024

It's likely a change to humacs / but within an emacs session, when we forward an ssh agent, we need to reload the ssh-agent vars.
We added a function to our doomconfig at some point, but it may have gotten removed.

@heyste
Copy link
Member

heyste commented Apr 11, 2024

Found it here in github.com/humacs/.spacemacs.d/ ...ii-tools/funcs.el

(defun ssh-find-agent ()
"Look for a running SSH agent on the host machine, and set it as our SSH_AUTH_SOCK.
This is useful for pushing changes to git repos using your ssh key, or for tramping in an org file to a remote machine.
It assumes you've added an ssh-agent and, if on a remote machine, forwarded it to that machine.

For more info, see: https://www.ssh.com/ssh/agent

This function is INTERACTIVE."
  (interactive)
  (setenv "SSH_AUTH_SOCK" (shell-command-to-string "find /tmp /run/host/tmp/ -type s -regex '.*/ssh-.*/agent..*$' 2> /dev/null | tail -n 1 | tr -d '\n'"))
  (message (getenv "SSH_AUTH_SOCK")))

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

No branches or pull requests

2 participants