自動登入github並把commit Push到gitHub的工具。
想用CGI接GitHub認證,讓CGI可以上傳檔案後自動認證並Commit。但卻找不到方法可以「跳過問答模式」登入,我們又不想管理私鑰,就在尋找各種解決方案。最後發現gitHub的https可以直接透過修改remote.origin.url
做到,假如原本是https://github.com/0mu-Project/Example
,只要改成https://username:[email protected]/0mu-Project/Example
就可以自動使用帳號密碼驗證。
CGI間接,或是其他沒有console但是想透過帳號密碼認證GitHub並Push Commit的場合。
./autoAuth.sh <github帳號> <github密碼> <repositorie路徑>
執行後,會自動把帳號密碼暫時性的寫入repositorie並push,再刪除帳號密碼資訊。
- 先檢查原本的網址中有沒有認證資訊(
username:password@
),如果有先刪掉 - 將
remote.origin.url
加入認證資訊 - 執行git push
- 把
remote.origin.url
當中的認證資訊刪掉