meta:git-remote: Add origin as fallback remote

In the rare case that no remote url containing `druckdev/dotfiles`
exists, this should still (try to) work.
This could be the case if I rename my username or the repo or in the
even rarer case that somebody forks this... Quite ambitious.
This commit is contained in:
2022-01-22 00:13:55 +01:00
parent 4c3dfc4c52
commit e14758170e

View File

@@ -6,6 +6,7 @@ die() {
} }
remote="$(git remote -v | grep -m1 "druckdev/dotfiles" | cut -f1)" remote="$(git remote -v | grep -m1 "druckdev/dotfiles" | cut -f1)"
: "${remote:=origin}"
url="$(git remote get-url "$remote")" url="$(git remote get-url "$remote")"
! printf "$url" | grep -q '^git@' || die "Using ssh already.\n" 0 ! printf "$url" | grep -q '^git@' || die "Using ssh already.\n" 0