Day: November 23, 2017

  • วิธีการใช้ Google Drive เป็น Private Git Repository

    git คือ distributed revision control system

    เรามักใช้ github.com สำหรับเก็บ source code แต่มัน public ซึ่ง บางทีเราก็ต้องการอะไรที่ private

    ต่อไปนี้ คือวิธีการใช้งาน Google Drive เพื่อสร้าง Private Git Repository

    1. ติดตั้ง Google Drive File Stream, git ให้เรียบร้อย
    2. ใน Google Drive สร้าง Directory ชื่อ git ขึ้นมาที่ My Drive
      กรณี Google Drive File Stream ก็จะเห็นที่
      G:\My Drive\git
    3. จากนั้น ก็สร้าง Working Directory  เช่น ที่ Documents
      ในภาพ สร้างไว้ใน Documents\firebase\fmsworkshop
      จากนั้น คลิก Git Bash Here
    4. ใช้คำสั่ง
      git init

      เพื่อสร้าง .git ใน Directory นี้ก่อน
      จากนั้นใช้คำสั่งนี้ ที่มี –bare เพื่อสร้าง Remore Repository บน Google Drive

      git init --bare "G:\My Drive\git\fmsworkshop.git"

    5. บน Google Drive File Stream ก็จะมี fmsworkshop.git ปรากฏขึ้น
      ซึ่งต่อไปก็สามารถ git push ขึ้นไปเก็บไว้ได้แล้ว
    6. ต่อไป ก็พัฒนาโปรแกรมไป
    7. แล้ว ก็ git push ตามปรกติครับ
      git add .
      git commit -m "some text"
      git push "G:\My Drive\git\fmsworkshop.git"

    หวังว่าจะเป็นประโยชน์ครับ