Git ใน Plesk

Plesk รองรับการทำงานกับ Git เพื่อจัดการ Git repositories และปรับใช้เว็บไซต์โดยอัตโนมัติจาก repositories โดยมี 2 รูปแบบ

  1. Local repository ส่งการเปลี่ยนแปลงจากเครื่องไปยัง Plesk ซึ่งจะปรับใช้การเปลี่ยนแปลงไปยังเว็บไซต์
  2. Remote Repository: ใช้งานร่วมกับแพลตฟอร์ม Git เช่น GitHub GitLab หรือ BitBucket โดย Plesk จะดึงการเปลี่ยนแปลงจาก repository เหล่านี้และปรับใช้ไปยังเว็บไซต์

Local repository

ส่งการเปลี่ยนแปลงจากเครื่องไปยัง Plesk

  • เข้าสู่ระบบ Plesk control panel
  • ไปที่ Websites & Domains และคลิก Git
  • คลิก Add Repository จะแสดงหน้า Create repository และเลือก Local repository
  • ใส่ชื่อสำหรับ Repository
  • กำหนดค่า Deployment Mode : Automatic หรือ Manual และ Deployment Path เช่น /httpdocs
  • กด Create เพื่อสร้าง repository คัดลอก url เพื่อนำไปใช้กับใช้คำสั่ง Git ใน terminal

หลังจากนั้นจะแสดงหน้า Git Repositories ซึ่งมีข้อมูลเกี่ยวกับ URL Branch ประวัติการ commit และมีปุ่ม Pull now จะดึงการเปลี่ยนแปลงจาก Remote Git repository ทันทีเมื่อคุณต้องการให้เว็บไซต์อัปเดตตาม repository โดยไม่ต้องรอการ deploy อัตโนมัติ

Remote Repository

โคลน Git repository จาก GitHub, BitBucket หรือแพลตฟอร์ม Git อื่น

  • เข้าสู่ระบบ Plesk control panel
  • ไปที่ Websites & Domains และคลิก Git
  • คลิก Add Repository จะแสดงหน้า Create repository และเลือก Remote repository
  • กรอก SSH Key หรือ HTTPS ในหน้าของ repository บน GitHosting
    1. สำหรับ HTTPS ต้องระบุ Username และ Password
    2. วาง SSH Key จะแสดง SSH public key ที่สร้างโดย Plesk อัตโนมัติ คัดลอกแล้วเพิ่มคีย์ SSH ในการตั้งค่าของ remote Git repository
  • กำหนด Deployment Mode (Automatic, Manual หรือ Disabled)
  • กด Create เพื่อสร้าง repository

หลังจากนั้นจะแสดงหน้า Git Repositories ซึ่งมีข้อมูลเกี่ยวกับ URL Branch ประวัติการ commit และมีปุ่ม Pull now จะดึงการเปลี่ยนแปลงจาก Remote Git repository ทันทีเมื่อคุณต้องการให้เว็บไซต์อัปเดตตาม repository โดยไม่ต้องรอการ deploy อัตโนมัติ

Was this article helpful?