နားလည်ထားရမယ့် အချက်
GitHub account ဆိုတာ အများစုထက် ပိုပြီး ပစ်မှတ်ကောင်းတစ်ခုပါ — လူတစ်ဦး ဒါမှမဟုတ် company တစ်ခု တည်ဆောက်ထားသမျှရဲ့ source code၊ deployment pipeline၊ secret တွေကို ထိန်းချုပ်ထားလေ့ရှိလို့ပါ။ ၎င်းကို ထိန်းချုပ်မှုဆုံးရှုံးရင် personal data ဆုံးရှုံးတာထက် ပိုဆိုးနိုင်ပါတယ်။
Two-factor authentication (2FA) ဟာ ဒီနေရာမှာ ပုံမှန် account ထက် ပိုအရေးကြီးပါတယ် — password တစ်ခုတည်း ခိုးယူခံရတာနဲ့ code push လုပ်ဖို့၊ pull request merge လုပ်ဖို့ ဒါမှမဟုတ် private repository ဖတ်ဖို့ လုံလောက်ဖို့ ဘယ်တော့မှ မဖြစ်သင့်ပါဘူး။ နေရာတိုင်းမှာ 2FA ဖွင့်ထားခြင်းက account ခိုးယူခံရနိုင်ချေ အများဆုံးလမ်းကြောင်းကို ပိတ်ပေးပါတယ်။
SSH key တွေက Git operation တွေအတွက် password authentication ကို cryptographic key pair နဲ့ အစားထိုးပေးပါတယ် — private key ဟာ သင့် machine ကနေ ဘယ်တော့မှ မထွက်ဘဲ public key ကို GitHub မှာ register လုပ်ထားပါတယ်။ SSH နဲ့ push/pull လုပ်တဲ့အခါ password ဘယ်တော့မှ network ကျော်ဖြတ်စရာမလိုဘဲ ကိုက်ညီတဲ့ private key ကိုင်ထားတယ်ဆိုတာ GitHub က verify လုပ်ပါတယ်။
Personal access token တွေကလည်း HTTPS-based Git operation နဲ့ API အတွက် ရည်ရွယ်ချက်တူတူပါပဲ — password ကို scope သတ်မှတ်ထားပြီး သက်တမ်းရှိတဲ့ credential နဲ့ အစားထိုးပါတယ်။ token ကောင်းတစ်ခုက task လိုအပ်တဲ့ permission သာ ပေးပြီး အလိုအလျောက် သက်တမ်းကုန်ကာ password ဒါမှမဟုတ် token တခြားကို မထိဘဲ ချက်ချင်း revoke လုပ်နိုင်ပါတယ်။
Private key ဒါမှမဟုတ် သက်တမ်းမကုန်သေးတဲ့ token ကို ဘယ်တော့မှ မမျှဝေပါနဲ့
password လိုပဲ ဆက်ဆံပါ — repository ထဲ commit မလုပ်ပါနဲ့၊ chat မှာ paste မလုပ်ပါနဲ့၊ email နဲ့ ပို့မပါနဲ့။ တစ်ခုခု ပေါက်ကြားသွားရင် ချက်ချင်း revoke ဒါမှမဟုတ် regenerate လုပ်ပါ — ချက်ချင်း compromised ဖြစ်ပြီလို့ မှတ်ပါ။
SSH KEY PAIR: LOCAL PRIVATE KEY, REMOTE PUBLIC KEY
--------------------------------------------------
YOUR COMPUTER GITHUB.COM
id_ed25519 (private key)
stays here, never shared
id_ed25519.pub
id_ed25519.pub ----- upload -------> (public key)
(safe to share) stored on your account
git push ---- SSH handshake proves you hold ----> accepted
the matching private keyလက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
ဒီမှာပြထားတဲ့ command ssh-keygen -t ed25519 -C "you@example.com" ကို throwaway directory တစ်ခုမှာ တကယ် run ပြီး အောက်က output အစစ်ကို ရယူထားပါတယ် — ဖန်တီးလိုက်တဲ့ key pair ကို ချက်ချင်း ဖျက်ပစ်လိုက်ပြီး ဘယ်နေရာမှာမှ register လုပ်ခဲ့ခြင်းမရှိပါဘူး။
ဒါက Ed25519 key pair မော်ဒန်တစ်စုံကို ဖန်တီးပေးပါတယ် — private key file တစ်ခုနဲ့ ကိုက်ညီတဲ့ .pub public key file တစ်ခု၊ ပြီးရင် fingerprint နဲ့ key ကနေ ဆင်းသက်လာတဲ့ randomart image ကို print ပေးပါတယ်။ run တိုင်းမှာ key ဟာ အသစ်ပြန် random ဖြစ်နေလို့ fingerprint နဲ့ randomart မတူညီပါဘူး — ကိုယ်ပိုင် output က ဒီ ဥပမာနဲ့ တိတိကျကျ ကိုက်ညီလိမ့်မယ်လို့ မမျှော်လင့်ပါနဲ့၊ ပုံစံချင်းသာ ကိုက်ညီမှာပါ။
Public key ကို register လုပ်ခြင်း
.pub file ရဲ့ content ကို copy ကူးပြီး GitHub website ရဲ့ Settings > SSH and GPG keys > New SSH key ထဲ paste ကူးပါ — GitHub က public half ကိုသာ သိမ်းထားပါတယ်။
Personal access token ဖန်တီးခြင်း
Settings > Developer settings သွားပြီး token type ရွေး၊ သက်တမ်းကုန်ရက်နဲ့ task လိုအပ်တဲ့ scope အနည်းဆုံးကို ရွေးချယ်ကာ generate လုပ်ပါ။
တစ်ကြိမ်တည်း သိမ်းခြင်း
GitHub က token ကို တစ်ကြိမ်တည်းသာ ပြပါတယ် — password လိုပဲ ဆက်ဆံပြီး text file ဒါမှမဟုတ် script ထဲထားမည့်အစား secret manager ထဲမှာ သိမ်းပါ။
Private key ဒါမှမဟုတ် သက်တမ်းမကုန်သေးတဲ့ token ကို ဘယ်တော့မှ မမျှဝေပါနဲ့
password လိုပဲ ဆက်ဆံပါ — repository ထဲ commit မလုပ်ပါနဲ့၊ chat မှာ paste မလုပ်ပါနဲ့၊ email နဲ့ ပို့မပါနဲ့။ တစ်ခုခု ပေါက်ကြားသွားရင် ချက်ချင်း revoke ဒါမှမဟုတ် regenerate လုပ်ပါ — ချက်ချင်း compromised ဖြစ်ပြီလို့ မှတ်ပါ။
GitHub Account လုံခြုံရေး Checklist
အတူတူ စမ်းရေးကြည့်မယ်
# Run in a throwaway directory only, never your real ~/.ssh
mkdir -p /tmp/ssh-demo && cd /tmp/ssh-demo
ssh-keygen -t ed25519 -C "you@example.com" -f ./id_ed25519 -N ""
ls -la
cat id_ed25519.pub
# cleanup -- this demo key is never registered anywhere
rm -f id_ed25519 id_ed25519.pubssh-keygen က ဒါကို print လုပ်ခဲ့ပါတယ်:
Generating public/private ed25519 key pair.
Your identification has been saved in ./id_ed25519
Your public key has been saved in ./id_ed25519.pub
The key fingerprint is:
SHA256:1pxNKgx8T7W/2wwRxANs0iSaWsp2srYYIPyhR7GA1uM you@example.com
The key's randomart image is:
+--[ED25519 256]--+
| .++o. |
|. . . o.o+oo |
|.o + o = .oo .. |
|o o +. B = = . . |
|...E * S * . o |
| .+... = . o |
| . o. o o |
| . + . = |
| . . . o|
+----[SHA256]-----+
.pub file ရဲ့ content:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGuo8yCutlQdHAWl6oARWtZ+xYlJ2jxBhpXpgAE0Ekv0 you@example.com
အထက်က fingerprint၊ randomart၊ key string တွေဟာ run တစ်ကြိမ်ကနေ ရလာတဲ့ output အစစ်ဖြစ်ပြီး key ဟာ အသစ်ပြန် random ဖြစ်နေလို့ run တိုင်း မတူညီပါဘူး။ ဒီနောက်ပိုင်း -- public key ကို GitHub ထဲ paste ထည့်ခြင်း၊ token ဖန်တီးခြင်း -- အားလုံးဟာ GitHub website ပေါ်မှာ ဖြစ်ပြီး capture လုပ်စရာ terminal output မရှိပါဘူး။၅ မိနစ် စမ်းကြည့်
throwaway directory တစ်ခုမှာ ssh-keygen -t ed25519 -C "your-email@example.com" -f ./test_key နဲ့ SSH key pair အစစ်တစ်ခု ဖန်တီးပြီး file နှစ်ခုလုံးကို ကြည့်ရှုကာ ဖျက်ပစ်ပါ။ သီးခြားအနေနဲ့ သင့် GitHub account အစစ်မှာ 2FA မဖွင့်ရသေးရင် ဖွင့်ပါ၊ ပြီးရင် task တစ်ခုတည်းလိုအပ်တာသာ scope သတ်မှတ်ပြီး ရက် 7 ရက် သက်တမ်းရှိတဲ့ personal access token တစ်ခု ဖန်တီးပါ၊ ပြီးရင် အသုံးပြီးရင် revoke လုပ်ပါ။
သတိလေးတစ်ချက်
private repo ထဲမှာဖြစ်ပါစေ private key ဒါမှမဟုတ် token ကို chat message၊ ticket ဒါမှမဟုတ် commit ထဲ paste လုပ်မိရင် ချက်ချင်း compromised ဖြစ်ပြီလို့ မှတ်ပြီး revoke လုပ်သင့်ပါတယ်။
task တစ်ခုစီအတွက် scope ကျဉ်း၊ သက်တမ်းတိုတဲ့ token အစား အဆင်ပြေလို့ scope ကျယ်ကျယ်၊ ထာဝရသုံးလို့ရတဲ့ token တစ်ခုတည်း ဖန်တီးလိုက်ရင် password ထက် token သုံးတဲ့ ရည်ရွယ်ချက်လုံးဝ ပျက်သွားပါတယ်။
GitHub Docs - Managing your personal access tokens — Git & GitHub