【发布时间】:2019-07-21 08:12:30
【问题描述】:
我有两个 github 帐户,他们的用户名是这样的:
subhayan-bhattacharya
subhayan-test
现在我想使用同一台机器在两个存储库中进行工作(推/拉)。因此我为此设置了两个 ssh 密钥。默认指向 subhayan-bhattacharya 帐户。
total 48
drwx------ 8 subhayan.bhattachary 1796758494 256 Jul 20 23:46 .
drwxr-xr-x+ 38 subhayan.bhattachary 1796758494 1216 Jul 20 23:46 ..
-rw-r--r-- 1 subhayan.bhattachary 1796758494 50 Jul 20 23:31 config
-rw------- 1 subhayan.bhattachary 1796758494 3401 Jun 14 15:28 id_rsa
-rw-r--r-- 1 subhayan.bhattachary 1796758494 755 Jun 14 15:28 id_rsa.pub
-rw-r--r-- 1 subhayan.bhattachary 1796758494 990 Jul 5 13:36 known_hosts
-rw------- 1 subhayan.bhattachary 1796758494 1856 Jul 20 23:41 newkeys
-rw-r--r-- 1 subhayan.bhattachary 1796758494 421 Jul 20 23:41 newkeys.pub
我已将相关的 ssh 密钥添加到各个 git hub 帐户的 ssh 和 gpg 密钥部分。
我的 .ssh/config 文件如下所示:
7tvmb228:.ssh subhayan.bhattachary$ vi config
Host *
AddKeysToAgent yes
UseKeychain yes
问题是我无法推送到 subhayan-test 帐户。我试过这样:
7tvmb228:starter-web subhayan.bhattachary$ ssh-add ~/.ssh/newkeys
Identity added: /Users/subhayan.bhattachary/.ssh/newkeys (subhayan.bhattachary@7tvmb228.fritz.box)
7tvmb228:starter-web subhayan.bhattachary$ git push
ERROR: Permission to subhayan-test/starter-web.git denied to subhayan-bhattacharya.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
~
我不知道为什么它说 subhayan-bhattacharya 的权限被拒绝,因为这是另一个 git hub 帐户名称。
但是,对其他帐户的推送和拉取工作正常。
我应该检查什么以及为什么这似乎不起作用。
【问题讨论】: