为 bitbucket 帐户设置 ssh-keys (with mac osx)
setting up ssh-keys for bitbucket account (with mac osx)
我有一个 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
然后我在我的 bitbucket 帐户的 ssh key
中添加了 my-key.pub 的内容。然后我重试克隆我的 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.
我在另一个 machine 上重复了相同的过程,它起作用了:
$ 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.
我现在需要在我的第一个 machine 上做同样的事情。
作为最后的手段,我使用 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.
我不知道第一个 machine 有什么不同,为什么它拒绝我的请求?
编辑 1
当然,我按照D.Samchuk
:
的建议尝试了最基本的方法
正在生成 id_rsa
$ ssh-keygen -t rsa
enterx3
复制了密钥的确切内容
$ cat ~/.ssh/id_rsa.pub
并且我在我的 BitBucket 帐户的 ssh 密钥中添加了 id_rsa.pub 的内容。
Git clone 仍然不允许我访问存储库,并输出与上面相同的错误消息。
编辑 2
我不知道这可能与 mac 配置有关?因为另一个 machine 是一个 redhat linux
我只是想知道但找不到任何报告的类似问题。
只需执行以下操作:
$ ssh-keygen -t rsa
姓名:id_rsa
密码:只需按两次回车键,以避免每次连接时打印关键字
$ cat ~/.ssh/id_rsa.pub
复制输出
打开 bitbucket --> 配置文件 --> bitbucket 设置 --> 添加 ssh 密钥 --> 粘贴你的输出
如果您没有为 ssh 密钥使用密码短语,则不需要 ssh-agent
https://help.github.com/articles/working-with-ssh-key-passphrases/
已解决。当我深入研究这个问题时,我发现它绝对与 ssh
键无关,而是与错误消息所建议的缺少存储库有关。这完全是关于使用 git config --global
试验全局配置,这搞砸了我在那台计算机上的 git 配置。我在另一个线程中详细说明了我的步骤:https://unix.stackexchange.com/questions/294780/git-retains-remote-information-from-a-deleted-repository/294809#294809.
我有一个 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
然后我在我的 bitbucket 帐户的 ssh key
中添加了 my-key.pub 的内容。然后我重试克隆我的 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.
我在另一个 machine 上重复了相同的过程,它起作用了:
$ 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.
我现在需要在我的第一个 machine 上做同样的事情。 作为最后的手段,我使用 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.
我不知道第一个 machine 有什么不同,为什么它拒绝我的请求?
编辑 1
当然,我按照D.Samchuk
:
正在生成 id_rsa
$ ssh-keygen -t rsa
enterx3
复制了密钥的确切内容
$ cat ~/.ssh/id_rsa.pub
并且我在我的 BitBucket 帐户的 ssh 密钥中添加了 id_rsa.pub 的内容。
Git clone 仍然不允许我访问存储库,并输出与上面相同的错误消息。
编辑 2
我不知道这可能与 mac 配置有关?因为另一个 machine 是一个 redhat linux
我只是想知道但找不到任何报告的类似问题。
只需执行以下操作:
$ ssh-keygen -t rsa
姓名:id_rsa
密码:只需按两次回车键,以避免每次连接时打印关键字
$ cat ~/.ssh/id_rsa.pub
复制输出
打开 bitbucket --> 配置文件 --> bitbucket 设置 --> 添加 ssh 密钥 --> 粘贴你的输出
如果您没有为 ssh 密钥使用密码短语,则不需要 ssh-agent
https://help.github.com/articles/working-with-ssh-key-passphrases/
已解决。当我深入研究这个问题时,我发现它绝对与 ssh
键无关,而是与错误消息所建议的缺少存储库有关。这完全是关于使用 git config --global
试验全局配置,这搞砸了我在那台计算机上的 git 配置。我在另一个线程中详细说明了我的步骤:https://unix.stackexchange.com/questions/294780/git-retains-remote-information-from-a-deleted-repository/294809#294809.