i've been trying to clean up my root directory so that it isn't clustered with random dotfiles. nonetheless, on setting up the ssh-key i came to a dead-end, where i wouldn't find a way to migrate known_hosts file to the other direction ($XDG_CONFIG_HOME/ssh/
).
i used this command to generate my ssh-key:
mkdir -p $XDG_CONFIG_HOME/ssh
ssh-keygen -t ed25519 -C "[email protected]" -f $XDG_CONFIG_HOME/ssh/id_ed25519
but yet i need to create a ~/.ssh/config
file to point at my $XDG_CONFIG_HOME/ssh/config
file, which is frustrating because i want to get rid of the ~/.ssh
directory
i used several approaches one of them was to set an env var SSH_CONFIG
to $XDG_CONFIG_HOME/ssh/config
but that didn't work either
⚠️ i'm using macOS and fish shell to prevent confusion
this is the $XDG_CONFIG_HOME/ssh/
directory structure:
config
id_ed25519
id_ed25519.pub
known_hosts #this file is ignored as ssh expects its in ~/.ssh/
this is the $XDG_CONFIG_HOME/ssh/config
file:
GlobalKnownHostsFile $XDG_CONFIG_HOME/ssh/known_hosts #this doesn't help either
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile $XDG_CONFIG_HOME/ssh/id_ed25519
and the current fix that is working, is only creating a .ssh/config
with the value UserKnownHostsFile $XDG_CONFIG_HOME/ssh/known_hosts
, which makes my whole migration of the files pointless.
.ssh/config
file:
UserKnownHostsFile $XDG_CONFIG_HOME/ssh/known_hosts
is there something that i'm missing?
how can i fix this?
or is there a better way of organising one selfs root folder?
i tried to set the env var SSH_CONFIG
but it seems to ignore it:
set -Ux SSH_CONFIG ~/.config/ssh/config #fish syntax, it's the same as: export SSH_CONFIG="$HOME/.config/ssh/config"