2012-11-08 141 views
13

我想通過http克隆私人git存儲庫。這裏有一個類似的問題:Git clone using http with user and passwordGit克隆http與密碼

有沒有辦法在沒有輸入用戶名/密碼的情況下執行git clone?

當我嘗試這樣做:

prodroom15:mquimiro$ git clone https://github.com/user:password/Automator.git 
Cloning into 'Automator'... 
Username for 'https://github.com': 
Password for 'https://github.com': 

我會怎麼做,這樣我就不必在用戶/密碼手動輸入?

請注意,在正常的https://github.com/user/Automator.git和手動輸入在提示符下的用戶/密碼工作正常。

回答

21

我認爲語法實際上是https://user:[email protected]而不是https://github.com/user:password

如果您使用的是Git 1.7.9或更高版本,請考慮使用更安全的credential helper mechanism

+0

謝謝,案件是顛倒語法。 – David542

+0

只是一個快速的不完整的網址然後會是這樣的'https:// user:password @ github.com/user/myrepo.git' – Sverre