git clone 能否自動輸入password ?? - Linux

Table of Contents


如題, 例如我有個專案, 裡面有3包code要build
假設是 proj_A, proj_B, proj_C 好了, 然後都放在server 上
它是跑 ssh 的 protocol

現在我想寫一個 shell script 或 makefile, 讓它一次就把這3包抓下來 build
script或makefile裡面, 大概是長這樣

git clone [email protected]:/gitrepo/proj_A
make
git clone [email protected]:/gitrepo/proj_B
make
git clone [email protected]:/gitrepo/proj_C
make

現在有個問題, 就是 git clone 它會要你輸入密碼 (假設密碼是 "123456" 好了)
我覺得每次跑 script 或 makefile都要重複打3次密碼, 實在很煩
而且萬一以後我這個專案長到10個20個怎麼辦? 總不能叫我每次都手動輸入吧?

有沒有方法能自動輸入 git clone 的密碼?


--

All Comments

Rosalind avatarRosalind2012-05-19
弄一個沒有密碼的 ssh key
Mason avatarMason2012-05-20
推樓上
Edwina avatarEdwina2012-05-21
把你的public key丟到server端不行嗎@@?
Emily avatarEmily2012-05-24
同意一樓
Necoo avatarNecoo2012-05-28
ssh-key / .netrc
Jessica avatarJessica2012-06-01
我是用 expect 去做...
Catherine avatarCatherine2012-06-06
不好意思, 5F 我看不太懂, 能否詳細一點解釋下, 謝謝
Xanthe avatarXanthe2012-06-07
你走ssh 的就用 ssh-key 你走 http 的就設 .netrc