dotfiles v1.1.11
This commit is contained in:
@@ -31,10 +31,12 @@ function keyme -d "Generate (or regenerate) an ed25519 SSH key for Gitea and con
|
||||
# If an IdentityFile line already exists under this Host, replace it;
|
||||
# otherwise add one after the HostName line.
|
||||
if grep -A5 "^Host $host\$" "$config_path" | grep -q "IdentityFile"
|
||||
sed -i "/^Host $host\$/,/^Host /s|IdentityFile .*|IdentityFile $key_path|" "$config_path"
|
||||
sed -i.bak "/^Host $host\$/,/^Host /s|IdentityFile .*|IdentityFile $key_path|" "$config_path"
|
||||
command rm -f "$config_path.bak"
|
||||
echo "Updated IdentityFile for Host $host in $config_path"
|
||||
else
|
||||
sed -i "/^Host $host\$/,/^Host /s|HostName .*|&\n\tIdentityFile $key_path|" "$config_path"
|
||||
sed -i.bak "/^Host $host\$/,/^Host /s|HostName .*|&\n\tIdentityFile $key_path|" "$config_path"
|
||||
command rm -f "$config_path.bak"
|
||||
echo "Added IdentityFile for Host $host in $config_path"
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user