一键使用用户名密码身份验证进行Git克隆 [英] Git clone with username password authentication in one go
问题描述
我当前的命令是
git clone ssh://username@onboard.com/srv/git/repo
之后
password
...很好,效果很好.
... fine, works good.
现在,我想一行执行此操作.像这样的东西:
Now I would like do this in one line. Something like that:
git clone ssh://username:password@onboard.com/srv/git/repo
但是它不起作用,并给我消息:
but it`s not working and gives me the message:
Please make sure you have the correct access rights and the repository exists.
如何克隆一行?
推荐答案
您应该能够使用http
网址来克隆它:
You should be able to use the http
url instead to clone it:
git clone http://username:password@onboard.com/srv/git/repo.git
编辑 :
Edit:
如果只有普通的ssh可以使用用户名密码凭据来完成此操作,请尝试使用sshpass
,例如:
If in case you can do this by normal ssh only with username-password credentials, try using sshpass
like:
sshpass -p password git clone ssh://username@onboard.com/srv/git/repo
您可能需要为此安装sshpass
.
请注意,当ssh密钥配置不正确时会出现这种情况.如果已配置ssh密钥,则您的公钥将与目标服务器共享,并且您无需输入密码(尽管您可能必须输入密码).
Note that this is the case when the ssh keys are not correctly configured; if the ssh keys were configured, your public key would be shared with the target server and you wouldn't have needed to enter the password (you might have had to enter a passphrase though).
这篇关于一键使用用户名密码身份验证进行Git克隆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!