Skip to content

0mu-Project/githubAutoAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

githubAutoAuth

自動登入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,再刪除帳號密碼資訊。

流程

  1. 先檢查原本的網址中有沒有認證資訊(username:password@),如果有先刪掉
  2. remote.origin.url加入認證資訊
  3. 執行git push
  4. remote.origin.url當中的認證資訊刪掉

About

Auto Login into Github and push commit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages