Integration WSL using Windows SSH agent
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
[core]
|
[core]
|
||||||
excludesfile = ~/.gitignore_global
|
excludesfile = ~/.gitignore_global
|
||||||
pager = delta
|
pager = delta
|
||||||
|
sshcommand = ssh.exe
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
name = Fabio Scotto di Santolo
|
name = Fabio Scotto di Santolo
|
||||||
@@ -75,3 +76,5 @@
|
|||||||
colorMoved = default
|
colorMoved = default
|
||||||
tabs = 4
|
tabs = 4
|
||||||
side-by-side = true
|
side-by-side = true
|
||||||
|
[credential]
|
||||||
|
helper = manager-core
|
||||||
|
|||||||
@@ -1,29 +1,8 @@
|
|||||||
is_debian_based() {
|
|
||||||
# Checking /etc/os-release
|
|
||||||
if [[ -f /etc/os-release ]]; then
|
|
||||||
. /etc/os-release
|
|
||||||
if [[ "$ID_LIKE" == *"debian"* ]] || [[ "$ID" == "debian" ]]; then
|
|
||||||
return 0 # OK: Debian-based
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Alternative check: /etc/debian_version
|
|
||||||
if [[ -f /etc/debian_version ]]; then
|
|
||||||
return 0 # OK: Debian-based
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1 # NO Debian-based
|
|
||||||
}
|
|
||||||
|
|
||||||
alias ls="eza --color=always --group-directories-first --icons=always"
|
alias ls="eza --color=always --group-directories-first --icons=always"
|
||||||
|
|
||||||
# Replace some more things with better alternatives
|
|
||||||
if is_debian_based; then
|
|
||||||
alias bat='batcat'
|
|
||||||
alias fd='fdfind'
|
alias fd='fdfind'
|
||||||
fi
|
|
||||||
|
|
||||||
alias cat='bat --style header --style snip --style changes --style header --pager never'
|
alias cat='batcat --style header --style snip --style changes --style header --pager never'
|
||||||
|
|
||||||
# Replace df command tool
|
# Replace df command tool
|
||||||
alias df='duf'
|
alias df='duf'
|
||||||
@@ -44,3 +23,5 @@ alias ip='ip -color'
|
|||||||
alias pbcopy='xsel --clipboard --input'
|
alias pbcopy='xsel --clipboard --input'
|
||||||
alias pbpaste='xsel --clipboard --output'
|
alias pbpaste='xsel --clipboard --output'
|
||||||
alias stow='stow -d $DOTFILES '
|
alias stow='stow -d $DOTFILES '
|
||||||
|
alias ssh-add='ssh-add.exe'
|
||||||
|
alias ssh='ssh-add.exe -l > /dev/null || ssh-add.exe && echo -e "\e[92mssh-key(s) are now available in your ssh-agent until you lock your windows machine! \n \e[0m" && ssh.exe'
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env zsh
|
|
||||||
|
|
||||||
# This script sets up ssh-agent and gpg-agent differently for WSL and Linux Mint.
|
|
||||||
# On WSL, it uses keychain to start agents.
|
|
||||||
# On Linux Mint (or other Linux), it assumes gnome-keyring manages agents automatically.
|
|
||||||
|
|
||||||
# Detect if running inside WSL by checking /proc/version for "Microsoft"
|
|
||||||
if grep -qi microsoft /proc/version; then
|
|
||||||
IS_WSL=true
|
|
||||||
else
|
|
||||||
IS_WSL=false
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$IS_WSL" = true ]; then
|
|
||||||
# We are in WSL - start keychain for ssh and gpg agents
|
|
||||||
# Adjust these variables to your actual SSH and GPG key names
|
|
||||||
SSH_KEY="$HOME/.ssh/id_rsa_deadalus"
|
|
||||||
#GPG_KEY=9DDD59AD62494FB2
|
|
||||||
|
|
||||||
# Check if keychain is installed
|
|
||||||
if command -v keychain >/dev/null 2>&1; then
|
|
||||||
SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
|
|
||||||
|
|
||||||
# Start keychain quietly with no GUI prompts for ssh agents
|
|
||||||
eval "$(keychain --quiet --nogui --agents ssh $SSH_KEY)"
|
|
||||||
|
|
||||||
# Get the filenames to store/lookup the environment from
|
|
||||||
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
|
|
||||||
_keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg"
|
|
||||||
|
|
||||||
# Source environment settings.
|
|
||||||
[ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh"
|
|
||||||
[ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg"
|
|
||||||
else
|
|
||||||
echo "Warning: keychain is not installed. Please install keychain to manage ssh/gpg agents."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
# Not WSL - assume gnome-keyring handles ssh-agent and gpg-agent
|
|
||||||
# Do nothing here to avoid conflicts with gnome-keyring
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -112,8 +112,8 @@ source $ZSH/oh-my-zsh.sh
|
|||||||
# alias zshconfig="mate ~/.zshrc"
|
# alias zshconfig="mate ~/.zshrc"
|
||||||
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
# alias ohmyzsh="mate ~/.oh-my-zsh"
|
||||||
|
|
||||||
# Setup vim keymap
|
# Setup Emacs keymap
|
||||||
bindkey -v
|
bindkey -e
|
||||||
|
|
||||||
fpath=(~/.zsh $fpath)
|
fpath=(~/.zsh $fpath)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user