【问题标题】:Berkshelf vendoring of cookbook on private Bitbucket repository在私有 Bitbucket 存储库上提供食谱的 Berkshelf 供应
【发布时间】:2015-06-01 14:46:38
【问题描述】:

我正在竭尽全力让 Berkshelf 从我们的私有 BitBucket (git) 存储库下载公司食谱。这是在 Windows 8.1 主机上。

我找到了this question 并尝试了答案中描述的内容。我还尝试了 Atlassian 建议的关于 here 的说明,尤其是在他们的页面上关于 ssh for multiple identities 的说明。

  • 我使用 puttygen 生成了一个公钥,并将其作为部署密钥添加到 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 的密码,我只是用 `enter' 确认,因为我把它留空了。但它不应该在没有提示的情况下直接阅读吗?

【问题讨论】:

    标签: git ssh vagrant bitbucket berkshelf


    【解决方案1】:

    这里有几个建议:

    • 确保在运行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一个,将公共一个添加到BitBucket repo)

    OP phpphil 确认in the comments

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

    【讨论】:

    • 天才!原来最后一点修复了它-我使用puttygen用户界面将密钥Conversions -> Export OpenSSH key导出为mykey.pub,然后简单地将配置更改为IdentityFile ~/.ssh/mykey.ppk。它也适用于相对路径。非常感谢,你拯救了我的一天:)
    • @phpPhil 太棒了!为了提高知名度,我已将您的结论包含在答案中。
    • 谢谢。由于我无法编辑我的评论,所以几乎没有更正......它应该是IdentityFile ~/.ssh/mykey.pubpub 而不是 ppk.
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-19
    • 2013-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多