download dotfiles without needing ssh key, then change origin to require

ssh key
This commit is contained in:
2025-07-08 20:22:43 +02:00
parent e35a2f703b
commit e3fa429c49

View File

@@ -1,13 +1,19 @@
#!/usr/bin/env bash
# helper to run git for dotfiles
cfggit() {
/usr/bin/git --git-dir="$HOME/.cfg" --work-tree="$HOME" "$@"
}
# set up my dotfiles
echo -e "\e[31m❌ Manual intervation needed: please be sure to add your ssh keys on github.\e[0m" >&2
echo -e "\e[31mPress any key to continue\e[0m" >&2
read -r
cd $HOME
if ! (git clone --bare git@github.com:danielepintore/dotfiles.git $HOME/.cfg &&
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME checkout -f &&
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME config --local status.showUntrackedFiles no); then
if ! (git clone --bare https://github.com/danielepintore/dotfiles.git $HOME/.cfg &&
cfggit checkout -f &&
cfggit config --local status.showUntrackedFiles no &&
cfggit remote set-url origin git@github.com:danielepintore/dotfiles.git); then
echo -e "\e[31m❌ Manual intervation needed: failed to setup your dotfiles.\e[0m" >&2
echo -e "\e[31mPress any key to continue\e[0m" >&2
read -r