两个不同的github帐户-访问问题

时间:2020-04-07 10:10:16

标签: git github

我有一个github帐户,并说一个用户名'abc'。如果我在其中创建一个存储库并将其克隆为系统上的

git clone https://github.com/abc/demo.git被克隆。

如果我使用用户名登录另一个github帐户,请说“ xyz”并在其中创建存储库,并且如果我尝试在与我相同的系统上克隆存储库

git clone https://github.com/xyz/demo.git会给出致命错误,例如

Cloning into 'demo'...
remote: Repository not found.
fatal: repository 'https://github.com/instructor-git/demo.git/' not found

我是git的新手,无法诊断问题我在做什么错。请帮忙。

2 个答案:

答案 0 :(得分:0)

网址中的

/xyz/不足以判断正在克隆哪个用户。您需要对此明确说明:xyz@

$ git clone https://xyz@github.com/xyz/demo.git

答案 1 :(得分:0)

有些使用ssh的解决方案。 我遇到了同样的问题,发现的唯一解决方案是:

  1. 生成带有正确“ repo”的访问令牌
  2. 在克隆网址中使用它

    git clone https://the_access_token@github.com/xyz/demo.git