I'm pulling my hair out trying to get Berkshelf to download a company cookbook from our private BitBucket (git) repository. This is on a Windows 8.1 host.
I found 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.
C:\Users\MyUser\.ssh\mykey.ppk
.I added C:\Users\MyUser\.ssh\config
with the following contents:
Host mycompany
HostName bitbucket.org
IdentityFile ~/.ssh/mykey.ppk
I try to include the cookbook in berksfile like this:
cookbook 'mycookbook', git: "git@mycompany:myteam/mycookbook.git", protocol: :ssh
When I run $ berks install -d
I get:
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.
Any idea why this is not working?
Do I have to replace 'git' in front of the @ with my user name?
Also - note that it asks me for the passphrase of the ppk, which I just confirm with `enter' as I left it blank. But shouldn't it just read it without prompting for it?
Here are a couple of suggestions:
HOME
is set to C:\Users\MyUser
when you are running the berks
command.Use a full path for the private key
Host mycompany
HostName bitbucket.org
IdentityFile /C/User/MyUser/.ssh/mykey.ppk
try and use rsa keys instead of private putty keys (ppk)
ssh-keygen -t rsa
(reference the private key in IdentityFile
: the id_rsa
one, add the public one to the BitBucket repo)
The OP phpphil confirms in the comments:
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.