我已经使用全局配置在我的系统上配置了帐户A,我可以从那里克隆我的所有存储库。
现在我不想更改配置,我想克隆并使用我的用户名和密码执行帐户B的所有操作。我该怎么做呢?
我试过了:
git clone username:passwordgit@github.com:*****/******.git
但没有成功。
发布于 2014-03-31 15:04:02
您可以尝试使用完整的https url:
git clone https://username:password@github.com/*****/******.git
如果省略https://
部分(并使用':
‘而不是'/'),它将被解释为ssh url。
https帮助页面"Which remote URL should I use?“确认https url可以访问私有repos。
注意:我不会直接将密码放在url中,而是放在use a credential manager to get the right password for the right user中。
git clone https://username@github.com/*****/******.git
发布于 2016-06-08 17:31:36
为了使语法更清晰,使用以下命令克隆私有存储库:
git clone https://[insert username]:[insert password]@github.com/[insert organisation name]/[insert repo name].git
示例:
git clone https://myusername:mypassword@github.com/myorgname/myreponame.git
https://stackoverflow.com/questions/22755268
复制相似问题