# Pastikan memiliki branch production
git branch
#jika belum ada
git checkout -b production
#upload ke repo
git push -u origin production
🔥 Flow kerja ideal
1️⃣ Coding → commit ke develop
2️⃣ Sudah stabil → merge ke master
git checkout master
git merge develop
git push
3️⃣ Mau deploy ke server → merge master → production
git checkout production
git merge master
git push
4️⃣ Di server VPS:
git pull origin production
🔥 STEP 1 — Pastikan folder untuk app1 sudah ada
Di VPS:
sudo mkdir -p /var/www/app1
sudo chown -R $USER:$USER /var/www/app1
🔥 STEP 2 — Setup SSH Key di VPS (wajib untuk git clone repo privat)
Jalankan di VPS:
ssh-keygen -t ed25519 -C "deploy-key"
cat ~/.ssh/id_ed25519.pub
🔥 STEP 3 — Tambahkan SSH Key ke GitHub
Pergi ke:
👉 GitHub → Settings → SSH and GPG Keys → New SSH Key
-
Title:
vps-prod -
Paste KEY yang tadi di-copy
🔥 STEP 4 — Test koneksi dari VPS ke GitHub
Di VPS jalankan:
ssh -T git@github.com
🔥 STEP 5 — Git clone projec ke app1 (branch production)
Masuk ke folder:
cd /var/www/app1
Clone pakai ssh URL repo kamu:
git clone -b production git@github.com:username/reponame.git .
0 komentar:
Posting Komentar