Menu

Showing posts with label remote. Show all posts
Showing posts with label remote. Show all posts

Tuesday, February 2, 2021

[GIT] วิธีการเพิ่ม Remote URL ของ GIT Repository
[GIT] How to Add New Remote URL of GIT Repository

 การเปลี่ยน Remote URL ของ GIT Repository จำเป็นต้องใช้ 2 คำสั่งดังนี้

  • คำสั่งสำหรับตรวจสอบ GIT remote URL ปัจจุบัน
    git remote -v
  • คำสั่งสำหรับตั้งค่า Remote URL ของ GIT Repository ใหม่
    git remote add <new_remote_name> <new_git_remote_url>
ตัวอย่างการใช้งาน เช่น
$ git remote -v
origin  git@github.com:username/project.git (fetch)
origin  git@github.com:username/project.git (push)
$ git remote add test git@github.com:username/project2.git
$ git remote -v 
origin  git@github.com:username/project.git (fetch)
origin  git@github.com:username/project.git (push)
test git@github.com:username/project2.git (fetch)
test git@github.com:username/project2.git (push)

ข้อมูลเพิ่มเติม สามารถอ่านได้ที่ Adding a remote

Sunday, December 15, 2019

[System] การตั้งค่าการเข้าใช้งาน โดยใช้ SSH Key บน Linux Server
[System] How To Configure SSH Key-Based Authentication on a Linux Server

สมมติว่า เรามี id_rsa.pub เป็น Public Key เรามีวิธีตั้งค่าการเข้าใช้งานดังนี้
  1. คัดลองข้อมูล key ในไฟล์ id_rsa.pub 
  2. Remote เข้าเครื่อง Server ด้วย user ที่มีสิทธิ์ root
  3. เปิดไฟล์ ~/.ssh/authorized_keys
  4. นำข้อมูล key จากข้อ 1 ไปเพิ่มต่อจาก key ที่มีอยู่ แล้วทำการบันทึก

Wednesday, December 11, 2019

[Ubuntu] วิธีการเพิ่มผู้ใช้งานใหม่และกำหนดให้เข้าใช้งานผ่าน SSH บน Ubuntu
[Ubuntu] How to Add New User and Set to Login by SSH on Ubuntu

  1. เพิ่มผู้ใช้งานในระบบ
  2. adduser <username>
  3. แก้ไขไฟล์ config สำหรับ SSH
  4. vim /etc/ssh/sshd_config
  5. ตั้งค่าอนุญาตให้ Login ด้วย password ได้
  6. # Change to no to disable tunnelled clear text passwords
    PasswordAuthentication yes
  7. กำหนด User ที่อนุญาตให้ login ผ่าน SSH ได้ (จะกำหนดหรือไม่ก็ได้)
  8. AllowUsers <username>
    คำเตือน!!! กรณีที่ตั้งค่า AllowUsers และต้องการให้ root สามารถ login ได้จำเป็นต้องใส่ root ในส่วนของ username ด้วย
    AllowUsers root userA
  9. กำหนด User ที่ไม่อนุญาตให้ login ผ่าน SSH ได้ (จะกำหนดหรือไม่ก็ได้)
  10. DenyUsers <username>
  11. Restart SSH service
  12. service ssh reload
หมายเหตุ อ่าน config เพิ่มเติมของ SSH ได้ที่ FreeBSD Manual Pages - sshd_config

Monday, September 2, 2019

[GIT] วิธีการเปลี่ยน Remote URL ของ GIT Repository
[GIT] How to Change Remote URL of GIT Repository

การเปลี่ยน Remote URL ของ GIT Repository จำเป็นต้องใช้ 2 คำสั่งดังนี้
  • คำสั่งสำหรับตรวจสอบ GIT remote URL ปัจจุบัน
    git remote -v
  • คำสั่งสำหรับตั้งค่า Remote URL ของ GIT Repository ใหม่
    git remote set-url <current_remote_name> <new_git_remote_url>
โดยที่ new_git_remote_url จะมีรูปแบบ URL ดังนี้
  • URL สำหรับ HTTPS
    https://github.com/USERNAME/REPOSITORY.git
  • URL สำหรับ SSH
    git@github.com:USERNAME/REPOSITORY.git