使用密码进行 Git 的 HTTP 克隆

15

我正在尝试通过http克隆一个私有git存储库。这里有一个类似的问题:使用用户和密码使用http进行git克隆

有没有一种方法可以在提示中不输入用户名和密码就执行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个回答

22

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

如果您使用的是Git 1.7.9或更高版本,请考虑使用更安全的 凭据助手机制


谢谢,问题是语法反了。 - David542
只是一个快速的提示,完整的URL将会像这样:https://user:password@github.com/user/myrepo.git - Sverre
如果我使用http而不是https,安全方面会发生什么? - variable

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接