6

I created a cookbook named foo, and want to use with Berkshelf.

I wrote like this in Berksfile:

cookbook 'foo', git: 'https://bitbucket.org/ironsand/cookbook-foo.git'

Then vendor the cookbook to cookbooks directory, but it failed with error like this:

berks vendor cookbooks
Resolving cookbook dependencies...
Fetching 'foo' from https://bitbucket.org/ironsand/cookbook-foo.git (at master)
Username for 'https://bitbucket.org':

How can I tell ssh username and key to Berkshelf? Of course my user have right to access the git repository.

ironsand
  • 14,329
  • 17
  • 83
  • 176
  • 1
    If you want to use the "ssh username and key", have you tried specifying an [SSH URL](https://confluence.atlassian.com/display/BITBUCKET/Use+the+SSH+protocol+with+Bitbucket#UsetheSSHprotocolwithBitbucket-RepositoryURLformatsbyconnectionprotocol) ? – Joe Oct 06 '14 at 11:40
  • I want to know how to specify the ssh URL with `berks` command. – ironsand Oct 06 '14 at 11:42
  • 1
    From bershelf documentation: "If you need to reference a private Github repository then you should use the :git location with the ssh protocol." So see @Joe link in SSH URL... – Tensibai Oct 06 '14 at 12:17
  • Oh, now I got what @Joe means, thanks! – ironsand Oct 07 '14 at 13:53

1 Answers1

14

If you want to use ssh authentication with your git provider, you need to use an SSH URL. Try something like this:

cookbook 'foo', git: 'git@bitbucket.org/ironsand/cookbook-foo.git'

That will use your SSH key to authenticate.

Tejay Cardon
  • 4,193
  • 2
  • 16
  • 31