Thursday, February 19, 2026

Change bind repository Github ใน project เรา

  • ประเด็นคือ สร้าง repo version github ชื่อใหม่เลย ไม่อยาก เปลี่ยนชื่อ
  • ทำประมาณนี้
  • สร้าง repo private github ไว้รอก่อน

Step

  • เข้าไป root project

$ cd myproject

  • ดูการผูก repo ปัจจุบันของ project folder

$ git remote -v

  • เปลี่ยน Remote URL ไปยัง  repo ที่เราสร้างใหม่ไว้รอ

$ git remote set-url origin https://github.com/juuier/mynewrepo.git

  • ดูการผูก repo ปัจจุบันของ project folder อีกรอบ

$ git remote -v

  • push code ขึ้น remote repo ใหม่

$ git push -u origin main

เพิ่มเติม

  • กรณีต้องการลบ Repo เก่า: หลังจากตรวจสอบที่ Repo ใหม่แล้วว่าไฟล์และประวัติมาครบ คุณสามารถเข้าไปลบ Repository myrepo ใน GitHub Settings ได้เลยครับ
  • หรือ กรณีเราไม่สร้าง repo ใหม่แค่เปลี่ยนชื่อ repo โดยไปที่ repo นั้น Settings ที่ Repository name 
  • จากนั้นเปลี่ยนชื่อและ คลิกปุ่ม Rename ครั้งแรกจะเป็นการตรวจสอบชื่อว่าซ้ำกับที่มีอยู่หรือไม่
  • จากนั้น คลิกปุ่ม Rename อีกครั้งเพื่อบันทึกการเปลี่ยนชื่อ
  • สุดท้ายสำคัญมาก ที่  project client ที่ผูก repo ไว้ ให้เปลี่ยนการผูกไปชื่อใหม่ด้วยคำสั่ง
$ git remote origin https://github.com/myuser/mynewrepo.git
$ git remote -v

Wednesday, February 18, 2026

เริ่มต้นอีกครั้งกับ Github

echo "# myproject" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/myuser/myproject.git
git push -u origin main

อธิบายโดย GPT

echo "# myproject" >> README.md

ความหมาย

➡️ เขียนข้อความ

# mdispen

ลงไปในไฟล์ชื่อ README.md

ถ้าไฟล์ยังไม่มี → จะสร้างไฟล์ใหม่ให้

ถ้ามีอยู่แล้ว → จะต่อท้ายลงไป

ใช้เพื่อสร้างไฟล์อธิบายโปรเจกต์ (หน้าแรกใน GitHub)

2️⃣

git init

ความหมาย

➡️ สร้าง Git repository ในโฟลเดอร์ปัจจุบัน

คือบอกว่า

โฟลเดอร์นี้ จะเริ่มใช้ Git แล้ว

หลังจากสั่ง จะมีโฟลเดอร์

.git

ถูกสร้างขึ้น

3️⃣

git add README.md

ความหมาย

➡️ เพิ่มไฟล์ README.md เข้า staging area

แปลว่า

เตรียมไฟล์นี้ไว้สำหรับ commit

ยังไม่ได้บันทึกจริง

4️⃣

git commit -m "first commit"

ความหมาย

➡️ บันทึกการเปลี่ยนแปลงลงใน Git

พร้อมข้อความอธิบายว่า

first commit

สรุปคือ

เก็บ snapshot แรกของโปรเจกต์

5️⃣

git branch -M main

ความหมาย

➡️ ตั้งชื่อ branch หลักเป็น main

-M = บังคับเปลี่ยนชื่อ

ใช้ในกรณีที่ branch เดิมอาจชื่อ master

ผลคือ

branch ปัจจุบัน = main

6️⃣

git remote add origin https://github.com/myuser/myproject.git

ความหมาย

➡️ ผูก repo ในเครื่อง

กับ repo บน GitHub

ชื่อ remote คือ

origin

ซึ่งชี้ไปที่

https://github.com/myuser/myproject.git

พูดง่าย ๆ คือ

บอก Git ว่า ปลายทางอยู่ที่ GitHub repo นี้

7️⃣

git push -u origin main

ความหมาย

➡️ ส่ง branch main ขึ้น GitHub

แยกความหมายได้เป็น

origin = ชื่อ remote

main = ชื่อ branch

-u = จำค่านี้ไว้เป็นค่าเริ่มต้น

หลังจากนี้คุณจะสามารถพิมพ์แค่

git push

ได้เลยในครั้งต่อไป

สรุป flow ทั้งชุดนี้ลำดับที่คุณทำคือ

สร้างไฟล์

→ สร้าง git

→ เตรียมไฟล์

→ commit

→ ตั้งชื่อ branch

→ ผูก GitHub

→ push ขึ้น GitHub

⚠️ สำคัญมาก (จาก error ที่คุณเคอเจอ)

จากบทสนทนาก่อนหน้าของคุณที่ขึ้นว่า

Password authentication is not supported

คำสั่งนี้

git push -u origin main

❌ จะใช้ "รหัสผ่าน GitHub" ไม่ได้แล้ว

ต้องใช้

✅ Personal Access Token (PAT)

แทนรหัสผ่าน

ตอนขึ้นถามว่า

Username for 'https://github.com':

Password for 'https://...':

ให้ใส่แบบนี้

Username → myuser

Password → 👉 วาง token

เพิ่มเติม

  • สร้างไฟล์ .gitignore  สำหรับไฟล์ .env หรือ node_module หรือ writable/* ไว้ไม่ต้อง up ขึ้นก็ได้ 
  • เปิด terminal ใน project folder แล้วรันคำสั่ง ตาม step ด้านบนใน project folder ได้เลย

ทบทวนสร้าง private key for remote ssh server

Server Linux Ubuntu

Client Windows 11

  • เปิด power shell

> ssh-keygen -t ed25519 -C "your_email@example.com"

  • ถ้าถาม  key ก็ enter ผ่านไปเลยไม่ต้องใส่ก็ได้ จะได้ไฟล์อยู่ที่
  • C:\Users\YourName\.ssh\
  • id_ed25519 -> private key
  • id_ed25519.pub - > public key
  • นำ Public Key ไปไว้ที่ Server (ฝั่ง Linux)
  • เปิดไฟล์  C:\Users\YourName\.ssh\id_ed25519.pub ใน notepad และ คัดลอก เนื้อหาใน public key ในนั้นไว้
  • จากนั้น remote linux server  วางเนื้อหา  public key ที่คัดลอกไว้จากฝั่ง client  

~/.ssh/authorized_keys

  • และบันทึกไฟล์ที่ server ให้เรียบร้อย
  • ทดสอบ ssh ฝั่ง windows client โดยเปิด power shell

> ssh user@remotehost 

Client Linux หรือ MacOS

$ ssh-keygen -t ed25519 -C "your_email@example.com"

ขั้นตอนการตอบคำถาม:

  1. ระบบจะถามที่เก็บไฟล์ (Enter file in which to save the key): ให้กด Enter เพื่อใช้ค่าเริ่มต้น (/Users/yourname/.ssh/id_ed25519)

  2. ระบบจะถาม Passphrase: แนะนำให้ตั้งรหัสผ่านสั้นๆ เพื่อล็อคไฟล์ Key ไว้ (หรือกด Enter ข้ามไปเลยถ้าไม่ต้องการ)

$ ssh-copy-id -i ~/.ssh/id_ed25519.pub username@server_ip
  • หลังจากนั้น Key จะถูกไปวางแบบ appendใน ~/.ssh/authorized_keys บน Server ให้ทันที
  • ทดสอบ ssh remote host ได้เลย หรือ ใช้ vscode remote ssh ได้เลย โดยใช้ private key เข้าระบบได้เลย

Sunday, February 15, 2026

Run OWASP ZAP บน windows 11 แล้ว error no jvm


  • โหลดและติดตั้ง ZAP 2.17 https://www.zaproxy.org/download/ สำหรับ windows 11 แล้วรันขึ้น Error
  • ไปโหลด  JDK 8.0++ มาก็รันไม่ได้ (มันเวอร์ชั่นเก่ามากๆ ต้องโหลดใหม่กว่านี้น่าจะผ่าน)

No JVM could be found on your system.
Please define EXE4J_JAVA_HOME to point to an installed 64-bit JDK or JRE or download a JRE from https://adoptium.net
Log: C:user...
Solved
  • เข้าเว็บ https://adoptium.net ดาวน์โหลด Eclipe OpenJDK มาแล้วติดตั้งก็รันได้แล้ว
  • หรือเข้าเว็บ  Oracle  ไปโหลด https://www.oracle.com/asean/java/technologies/downloads/

Monday, January 26, 2026

Install MariaDB / MySQL MacOS 26.2

  • ติดตั้ง 

$ brew install mariadb

  • ให้รันอัตโนมัติทุกครั้งที่เปิดเครื่อง:

$ brew services start mariadb

  • รันเฉพาะตอนที่อยากใช้งาน (Manual):

$ mariadb-server

  • ตั้งความปลอดภัย พร้อมตั้งรหัสผ่าน root (ถามรหัสผ่าน root ครั้งแรกกด enter ผ่านเลย)

$ sudo mariadb-secure-installation

  • เข้าสู่ระบบ

$ mariadb -u root -p

  • เปลี่ยนรหัสผ่าน root

$ mariadb-admin -u root -p password "รหัสผ่านใหม่ที่ต้องการ" 
  • ตรวจสอบการเปิดพอร์ต

$ sudo lsof -i -nP -P | grep LISTEN | grep 3306 

  • ถ้าอยากใช้ MySQL เปลี่ยน mariadb -> mysql

$ brew install mysql 

$ brew services start mysql

$ sudo mysql_secure_installation 

$ mysql -u root -p

$ brew services stop mariadb
$ brew uninstall mariadb 

Use CLI dcoker on MacOS

$ brew install colima $ colima start $ docker ps -a
Env
  • MacOS 26.2 

Ref

  • https://apple.stackexchange.com/questions/373888/how-do-i-start-the-docker-daemon-on-macos 

Popular Posts