Git 两个不同Bitbucket帐户的Bitbucket访问错误

Git 两个不同Bitbucket帐户的Bitbucket访问错误,git,ssh,bitbucket,bitbucket-server,Git,Ssh,Bitbucket,Bitbucket Server,我有两个比特桶账户。一个是办公室的,另一个是私人的。现在我还为这些帐户创建了两个SSH密钥并添加了密钥,但现在我似乎无法访问我的个人帐户 当我尝试使用git push-u origin develope时,出现以下错误: repository access denied. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the reposi

我有两个比特桶账户。一个是办公室的,另一个是私人的。现在我还为这些帐户创建了两个SSH密钥并添加了密钥,但现在我似乎无法访问我的个人帐户

当我尝试使用git push-u origin develope时,出现以下错误:

repository access denied.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
这是我的
.ssh/config
文件:

 1 Host bitbucket.org
 2        User git
 3        Hostname bitbucket.org
 4        IdentityFile ~/.ssh/id_rsa_bitbucket
 5        TCPKeepAlive yes
 6        IdentitiesOnly yes
 7
 8 Host bitbucket.org
 9        User git
 10        Hostname bitbucket.org
 11        IdentityFile ~/.ssh/id_rsa
 12        TCPKeepAlive yes
 13        IdentitiesOnly yes

第一个是我的办公室,第二个是我的个人帐户。你知道如何解决这个问题吗?

你必须用不同的名称来命名它们:

Host bitbucket1
    User git
    Hostname bitbucket.org
    IdentityFile ~/.ssh/id_rsa_bitbucket
    TCPKeepAlive yes
    IdentitiesOnly yes

Host bitbucket2
    User git
    Hostname bitbucket.org
    IdentityFile ~/.ssh/id_rsa
    TCPKeepAlive yes
    IdentitiesOnly yes

在您的git存储库中,使用
bitbucket1
bitbucket2
而不是
bitbucket.org
,您必须以不同的方式命名它们:

Host bitbucket1
    User git
    Hostname bitbucket.org
    IdentityFile ~/.ssh/id_rsa_bitbucket
    TCPKeepAlive yes
    IdentitiesOnly yes

Host bitbucket2
    User git
    Hostname bitbucket.org
    IdentityFile ~/.ssh/id_rsa
    TCPKeepAlive yes
    IdentitiesOnly yes

在您的git存储库中,使用
bitbucket1
bitbucket2
而不是
bitbucket.org

很可能与我的两个ssh密钥存在冲突,并且我的私人帐户无法从这台机器获得任何访问我的bitbucket的权限

因此,我突然想到将我的办公室ID分配给我的个人回购

Settings > User and Group Access > User
并给予ID管理员权限,它工作得很好


也许这不是一种优雅的方式,也不是问题的实际解决方案,但目前它工作得非常完美。

很可能是我的两个ssh密钥发生了冲突,我的私人帐户无法从这台机器获得任何访问我的Bitbucket的权限

因此,我突然想到将我的办公室ID分配给我的个人回购

Settings > User and Group Access > User
并给予ID管理员权限,它工作得很好


也许这不是一种优雅的方式,也不是问题的实际解决方案,但目前它工作得非常完美。

Bitbucket允许SSH访问repos时使用“git”或“hg”以外的用户名。您可以执行类似于git remote set url origin的操作myawesomeusername@bitbucket.org:owner/repo.git在您的工作相关回购协议上(假设“myawesomeusername”是您的用户名,“owner/repo.git”是相关回购协议的路径),或者您可以编辑每个repo中的.git/config文件以更改
git@bitbucket.org
的URL中的
myawesomeusername@bitbucket.org

Bitbucket允许SSH访问repos的用户名不是“git”或“hg”。您可以执行类似于git remote set url origin的操作myawesomeusername@bitbucket.org:owner/repo.git
在您的工作相关回购协议上(假设“myawesomeusername”是您的用户名,“owner/repo.git”是相关回购协议的路径),或者您可以编辑每个repo中的.git/config文件以更改
git@bitbucket.org
的URL中的
myawesomeusername@bitbucket.org

不幸的是,这并没有起到很好的作用:(但我采用了不同的方法。我将在另一个答案中解释。)>>>并且在您的git存储库中使用bitbucket1或bitbucket2而不是bitbucket.org在何处以及如何使用???在存储库的设置中,没有任何调整host@NurbekNurjanov在
git clone
git remote set url
中is也不起作用:(但我采用了不同的方法。我将在另一个答案中解释。)>>>并且在您的git存储库中使用bitbucket1或bitbucket2而不是bitbucket.org在何处以及如何使用???在存储库的设置中,没有任何调整host@NurbekNurjanov在
git clone
git远程设置url
中。