【发布时间】:2016-11-11 03:43:03
【问题描述】:
我有一个BitBucket 帐户。尽管在计算机上设置了ssh key,然后将其添加到我的bitbucket 帐户中,但我无法连接:
$ git clone git@bitbucket.org:my-account/myrepo.git
Cloning into 'myrepo'...
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我做了以下事情:
$ cd ~/.ssh
$ ssh-keygen -f ~/.ssh/my-key -N ''
$ vim config
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/my-key
$ ls -l
-rw------- 1 me ... 229 Jul 8 15:50 config
-rw------- 1 me ... 1679 Jul 8 14:07 my-key
-rw-r--r-- 1 me ... 411 Jul 8 14:07 my-key.pub
然后我将 my-key.pub 的内容添加到我的 bitbucket 帐户的 ssh keys 中。然后我重新尝试克隆我的repository:
$ git clone git@bitbucket.org:my-account/myrepo.git
Cloning into 'myrepo'...
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我在另一台机器上重复了相同的过程,它成功了:
$ git clone git@bitbucket.org:my-account/myrepo.git
Initialized empty Git repository in /home/me/.ssh/myrepo/.git/
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
我现在需要在我的第一台机器上做同样的事情。 作为最后的手段,我使用 ssh-agent 在网上遵循了一些建议:
$ eval `ssh-agent -s`
$ ssh-add ~/.ssh/my-key
但还是没有运气:
$ git clone git@bitbucket.org:my-account/myrepo.git
Cloning into 'myrepo'...
conq: repository does not exist.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我不知道第一台机器有什么不同,为什么它拒绝我的请求?
编辑 1
当然,正如D.Samchuk 所建议的那样,我尝试了非常基本的方法:
生成 id_rsa
$ ssh-keygen -t rsa
enterx3
复制了密钥的确切内容
$ cat ~/.ssh/id_rsa.pub
我在我的 BitBucket 帐户的 ssh 密钥中添加了 id_rsa.pub 的内容。
Git 克隆仍然不允许我访问存储库,并显示与上面相同的输出错误消息。
编辑 2
我不知道这可能与mac配置有关吗?由于另一台机器是redhat linux,我只是想知道但找不到任何报告的类似问题。
【问题讨论】:
-
我投票结束这个问题,因为它不是关于编程的。试试apple.stackexchange.com
-
我同意你很抱歉给您带来的麻烦。
标签: macos bitbucket ssh-keys ssh-agent