Skip to content

Commit 2829dbc

Browse files
sawyerbuttonclaude
andcommitted
fix(ci): use git init for first deploy to handle non-empty directory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b014d57 commit 2829dbc

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@ jobs:
2121
2222
DEPLOY_DIR=/opt/md2wechat
2323
24-
# First-time setup: clone if not a git repo yet
24+
# First-time setup: init git in existing directory
2525
if [ ! -d "$DEPLOY_DIR/.git" ]; then
2626
sudo mkdir -p "$DEPLOY_DIR"
2727
sudo chown $USER:$USER "$DEPLOY_DIR"
28-
# Preserve .env if it exists
29-
if [ -f "$DEPLOY_DIR/.env" ]; then
30-
cp "$DEPLOY_DIR/.env" /tmp/.env.bak
31-
fi
32-
git clone git@github.com:sawyerbutton/md2wechat.git "$DEPLOY_DIR"
33-
if [ -f /tmp/.env.bak ]; then
34-
mv /tmp/.env.bak "$DEPLOY_DIR/.env"
35-
fi
28+
cd "$DEPLOY_DIR"
29+
git init
30+
git remote add origin git@github.com:sawyerbutton/md2wechat.git
3631
fi
3732
3833
cd "$DEPLOY_DIR"

0 commit comments

Comments
 (0)