meta:install: Change shell and git remote to ssh

This commit is contained in:
2020-11-10 03:03:56 +01:00
parent bf46c5f687
commit 18d39e4d95
2 changed files with 23 additions and 0 deletions

16
meta/git-remote Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
die() {
printf "$1" >&2
exit ${2:-1}
}
remote="$(git remote get-url origin)"
! grep -q '^git@' <<<"$remote" || die "Using ssh already.\n" 0
host="$(cut -d/ -f3 <<<"$remote")"
grep -q "$host" "$HOME"/.ssh/known_hosts || die "No ssh key for $host found.\n"
ssh_remote="$(sed 's_^https\?://_git@_;s_/_:_' <<<"$remote")"
git remote set-url origin "$ssh_remote"
die "Set origin remote url to $ssh_remote\n" $?

View File

@@ -1,4 +1,11 @@
- shell: - shell:
-
command: chsh -s /usr/bin/zsh
description: Changing login shell to zsh
-
command: meta/git-remote
description: Updating git remote to use ssh
stderr: true
- -
command: meta/submodules --init command: meta/submodules --init
description: Pulling all submodules description: Pulling all submodules