Day: September 21, 2017

  • การใช้ GitHub Command Line #newbie

    Prerequisite

    • ต้องมี GitHub Account ก่อน ทำตามวิธีการนี้ https://help.github.com/articles/signing-up-for-a-new-github-account/
    • สร้าง GitHub Repository บน Web ก่อน  (ในที่นี้ จะสร้าง Repository ชื่อ mynewrepo) ซึ่งจะได้ URL มาเป็น https://github.com/your-username/mynewrepo.git

    สร้าง local repository

    mkdir mynewrepo
    cd mynewrepo
    git init
    git status

    สร้างไฟล์ใหม่

    # สมมุติสร้างไฟล์ใหม่
    echo "Hello World" > mynewfile.txt
    git add .
    git status

    ทำการ Commit

    git commit -m "This is a first Commit"

    สร้าง Connection ระหว่าง Local Folder กับ GitHub Repository

    git remote add origin https://github.com/your-username/mynewrepo.git
    git push -u origin master

    จากนั้น ใส่ Username/Password ของ GitHub Account

    ไปดูผลงานใน Repository “mynewrepo” ที่ https://github.com/your-username/mynewrepo

    เมื่อมีการแก้ไขไฟล์

    echo "Hello New World" >> mynewfile.txt
    git status

    ทำการ เพิ่ม > Commit > Push

    git add .
    git commit -m "This is a second Commit"
    git push -u origin master

    วนไป