Git repository တစ်ခုအတွက်သာ proxy သုံးခြင်း
Repository-local HTTP proxy သတ်မှတ်၍ remote URL အတွက် Git ရွေးသော configuration ကို စစ်ပြီး မလိုတော့လျှင် override ဖယ်ပါ။
ပရောဂျက်တစ်ခုက မတူသောချိတ်ဆက်မှုလိုရုံဖြင့် global Git proxy မလိုပါ။ ရှိပြီးသား checkout တွင် ကိုယ်ပိုင် local configuration ရှိသောကြောင့် ပြောင်းလဲမှုကို ထို repository တွင်ပဲ ထားနိုင်သည်။
နမူနာများက လက်ရှိ git config set/get/unset commands ကိုသုံးသည်။ project directory၊ remote URL နှင့် documentation IP သည် အစားထိုးတန်ဖိုးများဖြစ်သည်။ Public proxy ခွင့်ပြုသည့် public repository စမ်းသပ်မှုအတွက် HTTP proxy စာရင်း မှ ရွေးပါ။
git -C project config set --local http.proxy http://203.0.113.10:8080
git -C project ls-remote origin
Proxy URL တွင် transport scheme ပါဝင်သည်။ HTTPS remote ကလည်း CONNECT ပံ့ပိုးသည့် သာမန် HTTP proxy သုံးနိုင်သည်။ remote ၏ HTTPS scheme ကြောင့် proxy URL ကို HTTPS ပြောင်းရန် မလိုပါ။
Git တကယ်ရွေးထားသည်ကို စစ်ပါ
ရလဒ်မမျှော်လင့်သလိုဖြစ်လျှင် အမှန်တကယ် remote URL အတွက် ရွေးထားသည့်တန်ဖိုး စစ်ပါ။
git -C project config get --show-origin \
--url=https://example.com/team/project.git http.proxy
ထို query တွင် သင့်တကယ့် HTTPS remote ကို သုံးပါ။ Git တွင် system၊ user၊ repository၊ command-line၊ URL-specific ဆက်တင်များ ရှိနိုင်သည်။ global http.proxy တစ်ခုတည်းကြည့်လျှင် ပိုတိကျသည့် rule လွတ်နိုင်သည်။ origin output က ရလဒ်နောက်က file သို့မဟုတ် command-line source ကို သိစေသည်။
Local setting သည် repository မှ HTTP အသုံးပြုမှုအတွက်ဖြစ်ပြီး branch တစ်ခုတည်းအတွက် မဟုတ်ပါ။ HTTP remote များလျှင် ပထမစမ်းသပ်ရာအပြင် အခြားနေရာများလည်း သုံးနိုင်သည်။ ပိုကျဉ်းသော matching လိုလျှင် URL-specific HTTP settings ရှိသည်။
Checkout မရှိသေးမီ
ပထမ clone အတွက် override ကို ဆက်သိမ်းမည်မသိမ်းမည် ရွေးပါ။ ထို Git ခေါ်ဆိုမှုတစ်ခုတည်းအတွက်ဆိုလျှင် သုံးပါ။
git -c http.proxy=http://203.0.113.10:8080 \
clone https://example.com/team/project.git
Command-line override သည် checkout အသစ်တွင် အလိုအလျောက် permanent configuration entry မဖြစ်ပါ။ နောက် fetch များလည်း ထိုလမ်းကြောင်းသုံးရမည်ဆိုလျှင် နောက်မှ local value သတ်မှတ်ပါ။
SSH remote က သီးခြားကိစ္စ
git@host: သို့မဟုတ် ssh:// နှင့်စသော remote သည် SSH သုံးသည်။ Git HTTP proxy setting က HTTP transfer အဖြစ် မပြောင်းပါ။ SSH operation မအောင်မြင်သေးလို့သာ အလုပ်လုပ်သည့် proxy IP မပြောင်းမီ remote transport ကို စစ်ပါ။
Local override မလိုတော့လျှင် ထို key သာ ဖယ်ပါ။
git -C project config unset --local http.proxy
ဖယ်လိုက်လျှင် အခြားရင်းမြစ်များ၏ သက်ဆိုင်သော configuration ပြန်သက်ရောက်သည်။ စက်ပေါ်ရှိ proxy setting အားလုံးဖျက်သည့် command မဟုတ်ပါ။