Git克隆http用密码

时间:2012-11-08 21:33:53

标签: git github

我正在尝试通过http克隆私有git存储库。这里有一个类似的问题:Git clone using http with user and password

有没有办法在没有输入用户/密码的情况下进行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并在提示符下手动输入用户/密码正常。

1 个答案:

答案 0 :(得分:21)

我认为语法实际上是https://user:password@github.com而不是https://github.com/user:password

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