【发布时间】:2023-03-07 01:16:01
【问题描述】:
我正在尝试配置远程 linux 机器来访问我拥有的两个不同的 git 帐户。我不断获得身份验证访问权限。
> git push
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我已经采取的步骤,
- 生成了两组 ssh 密钥(称它们为
key1和key2) - 在
~/.ssh/config生成了一个配置文件 - 编辑了那个文件
1 # Default github account: key1
2 Host github.com
3 HostName github.com
4 IdentityFile ~/.ssh/key1
5 IdentitiesOnly yes
6
7 # Other github account: key2
8 Host github-key2
9 HostName github.com
10 IdentityFile ~/.ssh/key2
11 IdentitiesOnly yes
- 在用户帐户
settings/ssh keys下的两个git帐户中添加了.pub版本。 - 用
ssh-add ~/.ssh/key1将它们添加到我的虚拟机上
我真的不确定从这里去哪里以及下一步是什么,为什么这不起作用。我觉得我可能缺少一个步骤。
【问题讨论】: