環境:
系統: window 10 pro
git: version 2.23.0.windows.1
terminal: Windows PowerShell
步驟:
1. github個人主頁里生成token
Setting / Developer settings / Personal access tokens
點擊生成token,如下圖
拉到最下面點擊生成即可
生成后記得保存好token,這個token在github中只能查看一次。
3. git 拉取代碼或修改已拉取代碼范例:
clone:
git clone https://[你的token]@[你的項目路徑]
----
例:
git clone https://ghp_GW2bxXRpro0DEehtIDqF5wfvCFqTCi2xxxx@github.com/bingco-zhan/notes.git
本地已存在項目:
git remote set-url origin https://[你的token]@[你的項目路徑]
----
例:
git remote set-url origin https://ghp_GW2bxXRpro0DEehtIDqF5wfvCFqTCi2xxxx@github.com/bingco-zhan/notes.git
git pull origin main
---------------------------------
當然了,將token當做密碼使用也是沒有問題的。只是輸入略麻煩