]>
git.r.bdr.sh - rbdr/dotfiles/blob - zsh/functions/ssh-key-helpers.zsh
3 set-git-signing-key() {
6 if [[ -z "$key_path" ]]; then
7 echo "Error: Please provide a path to the private key to use to sign git commits." >&2
12 if [[ ! -f "$key_path" ]]; then
13 echo "Error: Key file does not exist: $key_path" >&2
17 local absolute_path
=$(readlink -f "$key_path")
19 ln -sf "$absolute_path" ~
/.ssh
/git
20 ln -sf "${absolute_path}.pub" ~
/.ssh
/git.pub
22 if [[ $?
-eq 0 ]]; then
23 echo "Successfully linked git signing key"
26 echo "Error: Failed to create symbolic link" >&2
33 local key_description
="$2"
35 if [[ -z "$key_name" ]]; then
36 echo "Error: Please provide a name for the key." >&2
40 if [[ -z "$key_description" ]]; then
41 echo "Error: Please provide a description for the key." >&2
45 ssh-keygen -t ed25519
-f ~
/.ssh
/id_ed25519_
${key_name}_
$(date +%Y-%m-%d) -C ${key_description}