使用用户名和密码克隆github的私人回购 [英] Clone a private repo of github with username and password

查看:366
本文介绍了使用用户名和密码克隆github的私人回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用全局配置在我的系统上配置了账户A,并且可以从那里克隆我的所有仓库。

I have configured Account A on my system with Global configurations and I can clone all my repos from there.

现在我不想更改配置,我想用我的用户名和密码克隆和执行帐户B的所有操作。

Now I don't want to change the configuration and I want to clone and do all operations of account B with my username and password. How can I do this?

我曾尝试过:

I have tried:

git clone username:passwordgit@github.com:*****/******.git



<您可以尝试使用完整的https网址:

But with no success.

推荐答案

b $ b

git clone https://username:password@github.com/*****/******.git

如果您省略 https:// 部分(并使用''而不是'/'),它会被解释为一个ssh url。

If you omit the https:// part (and use ':' instead of '/'), it would be interpreted like an ssh url.

GitHub帮助页面我应该使用哪一个远程URL?确认一个https url可以访问私人回购站。

The GitHub help page "Which remote URL should I use?" confirms an https url can access private repos.

注意:我不会把密码直接在url中,但使用凭证管理器为正确的用户获取正确的密码

Note: I wouldn't put the password directly in the url, but use a credential manager to get the right password for the right user.

git clone https://username@github.com/*****/******.git

这篇关于使用用户名和密码克隆github的私人回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆