Berkshelf 在私人 Bitbucket 存储库上销售食谱
Berkshelf vendoring of cookbook on private Bitbucket repository
我正在努力让 Berkshelf 从我们的私人 BitBucket (git) 存储库下载一本公司食谱。这是在 Windows 8.1 主机上。
我找到了 this question and have attempted what was described in the answer. I also played around with the instructions Atlassian advises about here and especially on their page about ssh for multiple identities。
- 我用 puttygen 生成了一个 public 密钥,并将其作为部署密钥添加到 Bitbucket 存储库。
- 私钥我保存在
C:\Users\MyUser\.ssh\mykey.ppk
.
我添加了C:\Users\MyUser\.ssh\config
,内容如下:
Host mycompany
HostName bitbucket.org
IdentityFile ~/.ssh/mykey.ppk
我尝试像这样将食谱包含在 berksfile 中:
cookbook 'mycookbook', git: "git@mycompany:myteam/mycookbook.git", protocol: :ssh
当我 运行 $ berks install -d
我得到:
Fetching 'mycookbook' from git@mycompany:myteam/mycookbook.git (at master)
Enter passphrase for key '/c/Users/MyUser/.ssh/mykey.ppk':
Git error: command `git clone git@mycompany:myteam/mycookbook.git "C:/Users/MyUser/.berkshelf/.cache/git/6d5b957656d1bda26bf05aea558176c86db263f2" --bare --no
-hardlinks` failed. If this error persists, try removing the cache directory at 'C:/Users/MyUser/.berkshelf/.cache/git/6d5b957656d1bda26bf05aea558176c86db263f2'.Output from the command:
Cloning into bare repository 'C:/Users/MyUser/.berkshelf/.cache/git/6d5b957656d1bda26bf05aea558176c86db263f2'...
Permission denied (publickey).
fatal: Could not read from remote repository.
知道为什么这不起作用吗?
我必须用我的用户名替换@前面的'git'吗?
此外 - 请注意,它要求我提供 ppk 的密码,我只是用“输入”确认,因为我将其留空。但是它不应该在没有提示的情况下直接阅读吗?
这里有一些建议:
- 当您使用 运行 命令
berks
时,请确保将环境变量 HOME
设置为 C:\Users\MyUser
。
使用私钥的完整路径
Host mycompany
HostName bitbucket.org
IdentityFile /C/User/MyUser/.ssh/mykey.ppk
尝试使用 rsa 密钥而不是私有 putty 密钥 (ppk)
ssh-keygen -t rsa
(参考 IdentityFile
中的 private 键:id_rsa
一个,将 public 一个添加到 BitBucket 存储库)
OP phpphil confirms :
Turned out the last point fixed it - I used the puttygen user interface to export the key Conversions -> Export OpenSSH key
as mykey.pub
, then simply changed the config to IdentityFile ~/.ssh/mykey.pub
.
It worked with the relative path as well.
我正在努力让 Berkshelf 从我们的私人 BitBucket (git) 存储库下载一本公司食谱。这是在 Windows 8.1 主机上。
我找到了 this question and have attempted what was described in the answer. I also played around with the instructions Atlassian advises about here and especially on their page about ssh for multiple identities。
- 我用 puttygen 生成了一个 public 密钥,并将其作为部署密钥添加到 Bitbucket 存储库。
- 私钥我保存在
C:\Users\MyUser\.ssh\mykey.ppk
. 我添加了
C:\Users\MyUser\.ssh\config
,内容如下:Host mycompany HostName bitbucket.org IdentityFile ~/.ssh/mykey.ppk
我尝试像这样将食谱包含在 berksfile 中:
cookbook 'mycookbook', git: "git@mycompany:myteam/mycookbook.git", protocol: :ssh
当我 运行 $ berks install -d
我得到:
Fetching 'mycookbook' from git@mycompany:myteam/mycookbook.git (at master)
Enter passphrase for key '/c/Users/MyUser/.ssh/mykey.ppk':
Git error: command `git clone git@mycompany:myteam/mycookbook.git "C:/Users/MyUser/.berkshelf/.cache/git/6d5b957656d1bda26bf05aea558176c86db263f2" --bare --no
-hardlinks` failed. If this error persists, try removing the cache directory at 'C:/Users/MyUser/.berkshelf/.cache/git/6d5b957656d1bda26bf05aea558176c86db263f2'.Output from the command:
Cloning into bare repository 'C:/Users/MyUser/.berkshelf/.cache/git/6d5b957656d1bda26bf05aea558176c86db263f2'...
Permission denied (publickey).
fatal: Could not read from remote repository.
知道为什么这不起作用吗?
我必须用我的用户名替换@前面的'git'吗?
此外 - 请注意,它要求我提供 ppk 的密码,我只是用“输入”确认,因为我将其留空。但是它不应该在没有提示的情况下直接阅读吗?
这里有一些建议:
- 当您使用 运行 命令
berks
时,请确保将环境变量HOME
设置为C:\Users\MyUser
。 使用私钥的完整路径
Host mycompany HostName bitbucket.org IdentityFile /C/User/MyUser/.ssh/mykey.ppk
尝试使用 rsa 密钥而不是私有 putty 密钥 (ppk)
ssh-keygen -t rsa
(参考 IdentityFile
中的 private 键:id_rsa
一个,将 public 一个添加到 BitBucket 存储库)
OP phpphil confirms
Turned out the last point fixed it - I used the puttygen user interface to export the key
Conversions -> Export OpenSSH key
asmykey.pub
, then simply changed the config toIdentityFile ~/.ssh/mykey.pub
.
It worked with the relative path as well.