伯克希尔在私有Bitbucket存储库上出售烹饪书



我绞尽脑汁想让Berkshelf从我们的私有BitBucket (git)存储库下载公司食谱。

我发现了这个问题,并尝试了答案中描述的内容。我还尝试了Atlassian在这里建议的说明,特别是在他们关于ssh用于多个身份的页面上。

    我已经用puttygen生成了一个公钥,并将其作为部署密钥添加到Bitbucket repo中。
  • 我将私钥保存在C:UsersMyUser.sshmykey.ppk .
  • 我添加了C:UsersMyUser.sshconfig,内容如下:

    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的密码短语,我只是用' enter'确认,因为我把它留空。但它不应该直接阅读而不需要提示吗?

以下是一些建议:

  • 确保在执行berks命令时将环境变量HOME设置为C:UsersMyUser
  • 为私钥使用完整路径

    Host mycompany
    HostName bitbucket.org
    IdentityFile /C/User/MyUser/.ssh/mykey.ppk
    
  • 尝试使用rsa密钥代替私有putty密钥(ppk)

    ssh-keygen -t rsa
    

(引用IdentityFile中的私钥: id_rsa中的私钥,将公钥添加到BitBucket repo)

OP phpphil在注释中确认:

结果是最后一点修复了它-我使用puttygen用户界面将密钥 Conversions -> Export OpenSSH key 导出为mykey.pub,然后简单地将配置更改为IdentityFile ~/.ssh/mykey.pub。它也适用于相对路径。

最新更新