我有两个Bitbucket帐户。一个是办公室用的,另一个是个人用的。现在,我还为这些帐户创建了两个SSH密钥,并添加了密钥,但现在我似乎无法访问我的个人帐户。
当我尝试git push -u origin develop时,我得到这个错误:
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第一个是我的办公室,第二个是我的个人账户。你知道我怎么解决这个问题吗?
发布于 2017-07-13 21:05:30
你必须给它们起不同的名字:
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。
发布于 2017-07-13 21:54:08
最有可能的是,我的两个ssh密钥发生了冲突,我的私人帐户无法从这台机器获得对我的Bitbucket的任何许可。
所以我突然想到从把我的办公室ID分配给我的个人存储库
Settings > User and Group Access > User然后给那个ID Admin权限,它就完美地工作了。
也许这不是优雅的方式,也不是问题的实际解决方案,但它在这一时刻工作得很好。
发布于 2017-07-14 04:15:12
Bitbucket允许"git“或"hg”以外的用户名通过SSH访问repos。您可以对与工作相关的存储库执行类似git remote set-url origin myawesomeusername@bitbucket.org:owner/repo.git的操作(假设"myawesomeusername“是您的用户名,"owner/repo.git”是相关存储库的路径),或者您可以编辑每个存储库中的.git/git remote set-url origin myawesomeusername@bitbucket.org:owner/repo.git文件,将URL中的git@bitbucket.org更改为myawesomeusername@bitbucket.org。
https://stackoverflow.com/questions/45079231
复制相似问题