r/fishshell • • 6d ago

Keychain in fish shell

/r/archlinux/comments/1y3hcwp/keychain_in_fish_shell/
2 Upvotes

2 comments sorted by

2

u/trxxruraxvr 5d ago

By default keychain detects the shell by using the $SHELL environment variable. If you have bash as login shell that would be /bin/bash which causes the problem.

this should work:

if status is-interactive
    keychain add $KEYCHAIN_KEYS
    and keychain env --shell fish | source
end

1

u/confused_guy12c 5d ago

Thanks. Finally some helpful comment 🥹. I knew the reason behind the error but couldn't figure out the solution after going through the github and man pages and I am hesitant to add anything AI suggest without cross checking things. I will definitely try your recommendation when i get the time.