作者sb5471 (SB)
看板Linux
標題[問題] git clone 能否自動輸入password ??
時間Mon May 14 23:05:43 2012
如題, 例如我有個專案, 裡面有3包code要build
假設是 proj_A, proj_B, proj_C 好了, 然後都放在server 上
它是跑 ssh 的 protocol
現在我想寫一個 shell script 或 makefile, 讓它一次就把這3包抓下來 build
script或makefile裡面, 大概是長這樣
git clone myname@my.git.server:/gitrepo/proj_A
make
git clone myname@my.git.server:/gitrepo/proj_B
make
git clone myname@my.git.server:/gitrepo/proj_C
make
現在有個問題, 就是 git clone 它會要你輸入密碼 (假設密碼是 "123456" 好了)
我覺得每次跑 script 或 makefile都要重複打3次密碼, 實在很煩
而且萬一以後我這個專案長到10個20個怎麼辦? 總不能叫我每次都手動輸入吧?
有沒有方法能自動輸入 git clone 的密碼?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.43.215.196
→ legnaleurc:弄一個沒有密碼的 ssh key 05/14 23:19
→ dou0228:推樓上 05/14 23:36
→ carlcarl:把你的public key丟到server端不行嗎@@? 05/14 23:58
推 johnjohnlin:同意一樓 05/15 00:42
→ hSATAC:ssh-key / .netrc 05/15 08:56
推 N2I:我是用 expect 去做... 05/15 15:12
→ sb5471:不好意思, 5F 我看不太懂, 能否詳細一點解釋下, 謝謝 05/15 22:50
→ hSATAC:你走ssh 的就用 ssh-key 你走 http 的就設 .netrc 05/16 19:51