0
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-10-17 04:16:52 +02:00

Revert "feat(ssh-agent): add keys regardless of filename (#12741)" (#12761)

This reverts commit d2d5155d41.

Closes #12743
Closes #12745
Closes #12758
This commit is contained in:
Carlo Sala 2024-10-15 13:02:12 +02:00 committed by GitHub
parent b3ba8da421
commit 09a9467200
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,16 +39,13 @@ function _add_identities() {
return
fi
# If no keys specified in zstyle, add default keys.
# Mimics calling ssh-add with no arguments.
if [[ ${#identities[@]} -eq 0 ]]; then
# Iterate over files in .ssh folder.
for file in "$HOME/.ssh"/*; do
# Check if file is a regular file and starts with "-----BEGIN OPENSSH PRIVATE KEY-----".
if [[ -f "$file" && $(command head -n 1 "$file") =~ ^-----BEGIN\ OPENSSH\ PRIVATE\ KEY----- ]]; then
# Add filename (without path) to identities array.
identities+=("${file##*/}")
fi
# add default keys if no identities were set up via zstyle
# this is to mimic the call to ssh-add with no identities
if [[ ${#identities} -eq 0 ]]; then
# key list found on `ssh-add` man page's DESCRIPTION section
for id in id_rsa id_dsa id_ecdsa id_ed25519 id_ed25519_sk identity; do
# check if file exists
[[ -f "$HOME/.ssh/$id" ]] && identities+=($id)
done
fi