Update deploy script to include SSH key management and specify port in remote URL
This commit is contained in:
parent
90a8bf7e3d
commit
7761cf681d
1 changed files with 5 additions and 1 deletions
|
|
@ -4,12 +4,16 @@ set -euo pipefail
|
||||||
VPS="${1:-hetzner}"
|
VPS="${1:-hetzner}"
|
||||||
REMOTE_BRANCH="${2:-main}"
|
REMOTE_BRANCH="${2:-main}"
|
||||||
REMOTE_BASE='/opt/websites/adrian-altner.de'
|
REMOTE_BASE='/opt/websites/adrian-altner.de'
|
||||||
REMOTE_URL='ssh://git@git.altner.cloud/adrian/adrian-altner.de.git'
|
REMOTE_URL='ssh://git@git.altner.cloud:2222/adrian/adrian-altner.de.git'
|
||||||
|
GIT_HOST='git.altner.cloud'
|
||||||
|
GIT_PORT='2222'
|
||||||
|
|
||||||
# --- 1. Pull latest from repo ---
|
# --- 1. Pull latest from repo ---
|
||||||
ssh "$VPS" "
|
ssh "$VPS" "
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd '$REMOTE_BASE'
|
cd '$REMOTE_BASE'
|
||||||
|
mkdir -p ~/.ssh && touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
|
||||||
|
ssh-keygen -F '[$GIT_HOST]:$GIT_PORT' >/dev/null || ssh-keyscan -p '$GIT_PORT' '$GIT_HOST' >> ~/.ssh/known_hosts
|
||||||
git remote set-url origin '$REMOTE_URL'
|
git remote set-url origin '$REMOTE_URL'
|
||||||
git fetch --prune origin '$REMOTE_BRANCH'
|
git fetch --prune origin '$REMOTE_BRANCH'
|
||||||
git checkout '$REMOTE_BRANCH'
|
git checkout '$REMOTE_BRANCH'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue