【发布时间】:2022-01-29 04:33:18
【问题描述】:
除了第一个之外,我还在笔记本电脑上添加了第二个 github 帐户。文档https://betterprogramming.pub/how-to-use-multiple-github-accounts-with-one-computer-c9ba3f851b75 确实有很大帮助,但我在克隆可以从第二个 github 帐户访问的 repo 时遇到问题。
我生成了密钥id_rsa_unaccount和id_rsa_unaccount.pub,并将id_rsa_unaccount.pub的内容添加到我在第二个github帐户的ssh字段中。
>ls ~/.ssh
config id_rsa id_rsa.pub id_rsa_unaccount id_rsa_unaccount.pub
更新了~/.ssh/config
# Account 1 (work or personal) - the default config
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
# Account 2 (personal) - the config we are adding
Host github-unaccount
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_unaccount
也设置
git config user.name "Gupastha"
git config user.email "asthagupta92+8@gmail.com"
但是,当我尝试 git clone 存储库时,我看到了
git clone git@github-unaccount:Noble-Missions/itakeactions.git
Cloning into 'itakeactions'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
我也经历了多个堆栈溢出链接,但我还没有找到克隆的解决方案。有人可以轻推我吗?
【问题讨论】: