Answers: <p>Quoting from the cookbook <a href="https://github.com/poise/application_git/blob/master/README.md#properties" rel="nofollow noreferrer">README</a>:</p>
  
  <blockquote>
    <p>deploy_key – SSH key to use with git. Can be specified either as a
    path to key file already created or as a string value containing the
    key directly.</p>
  </blockquote>
  
  <p>And:</p>
  
  <blockquote>
    <p>The application_git resource deploys code from git. It extends the
    core git resource to support deploy keys and disabling strict host key
    verification.</p>
  </blockquote>
  
  <p>So checking the core git resource <a href="https://docs.chef.io/resource_git.html#properties" rel="nofollow noreferrer">documentation</a>:</p>
  
  <blockquote>
    <p>ssh_wrapper Ruby Type: String</p>
    
    <p>The path to the wrapper script used when running SSH with git. The
    GIT_SSH environment variable is set to this.</p>
  </blockquote>
  
  <p>so something like this (untested) should do (using the wrapper in the cookbook) :</p>
  
  <pre><code>cookbook_file '/path/to/my/desired/ssh_wrapper.sh' do
    source 'my_ssh_wrapper.sh'
  end
  
  application 'accounts' do
    action :deploy
    path &lt;somepath&gt;
    owner 'nobody'
    group 'nogroup'
    git 'name' do
      repository &lt;repopath&gt;
      revision &lt;value&gt;
      ssh_wrapper '/path/to/my/desired/ssh_wrapper.sh'
      deploy_key deploy_key
   end
  end 
  </code></pre>
  
  <p>You can of course do the same with the deploy_key, but using something like chef_vault or an encrypted databag sounds better to avoid commiting deploy keys within the cookbook.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-05-29T05:10:59.857Z
Answers: Ssh_wrapper change will work with this. But main issue is for deploy_key path
Answers: Arora20
Answers: CC BY-SA 4.0
Answers: 2018-05-29T07:24:37.867Z
Answers: What is the problem using another cookbook_file resource for deploy_key ?
Answers: Tensibai
Answers: CC BY-SA 4.0
Answers: 2018-05-28T15:20:44.950Z
Answers: 2018-05-28T15:20:44.950Z
Answers: Tensibai
Body: <p>I am using Chef 12.0.3 for managing servers. Earlier I was using application cookbook for cloning repository. But now in higher version of application cookbook, this support is moved to new cookbook application_git.</p>
  
  <p>Issue:</p>
  
  <ol>
  <li>I want to change the path of deploy key</li>
  <li>Contents of ssh_wrapper</li>
  <li>Path of ssh_wrapper.</li>
  </ol>
  
  <p>What I have tried (Current code):</p>
  
  <pre><code>application 'accounts' do
    action :deploy
    path &lt;somepath&gt;
    owner 'nobody'
    group 'nogroup'
    git 'name' do
      repository &lt;repopath&gt;
      revision &lt;value&gt;
      deploy_key deploy_key
   end
  end 
  </code></pre>
  
  <p>I am not able to find if I need to pass path using ssh_wrapper_path or ssh_wrapper or deploy_key_path. All are failing.</p>
  
  <p>Currently, I am able to get keys and wrapper but at a wrong place.</p>
  
Tags: <git><deployment><chef>
Title: Customizing deploy key and ssh wrapper path for git cloning through application_git cookbook
UserDisplayName: Arora20
ThreadText: # Customizing deploy key and ssh wrapper path for git cloning through application_git cookbook
  
  (Asked by: username_0 on 2018-05-28)
  
  I am using Chef 12.0.3 for managing servers. Earlier I was using application cookbook for cloning repository. But now in higher version of application cookbook, this support is moved to new cookbook application\_git.
  
  Issue:
  
  1. I want to change the path of deploy key
  2. Contents of ssh\_wrapper
  3. Path of ssh\_wrapper.
  
  What I have tried (Current code):
  
  ```
  application 'accounts' do
    action :deploy
    path <somepath>
    owner 'nobody'
    group 'nogroup'
    git 'name' do
      repository <repopath>
      revision <value>
      deploy_key deploy_key
   end
  end 
  
  ```
  
  I am not able to find if I need to pass path using ssh\_wrapper\_path or ssh\_wrapper or deploy\_key\_path. All are failing.
  
  Currently, I am able to get keys and wrapper but at a wrong place.
  
  **Tags:** git, deployment, chef
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-05-28. Score: 1
  
  Quoting from the cookbook [README](https://github.com/poise/application_git/blob/master/README.md#properties):
  
  > deploy\_key – SSH key to use with git. Can be specified either as a
  > path to key file already created or as a string value containing the
  > key directly.
  
  And:
  
  > The application\_git resource deploys code from git. It extends the
  > core git resource to support deploy keys and disabling strict host key
  > verification.
  
  So checking the core git resource [documentation](https://docs.chef.io/resource_git.html#properties):
  
  > ssh\_wrapper Ruby Type: String
  >
  > The path to the wrapper script used when running SSH with git. The
  > GIT\_SSH environment variable is set to this.
  
  so something like this (untested) should do (using the wrapper in the cookbook) :
  
  ```
  cookbook_file '/path/to/my/desired/ssh_wrapper.sh' do
    source 'my_ssh_wrapper.sh'
  end
  
  application 'accounts' do
    action :deploy
    path <somepath>
    owner 'nobody'
    group 'nogroup'
    git 'name' do
      repository <repopath>
      revision <value>
      ssh_wrapper '/path/to/my/desired/ssh_wrapper.sh'
      deploy_key deploy_key
   end
  end 
  
  ```
  
  You can of course do the same with the deploy\_key, but using something like chef\_vault or an encrypted databag sounds better to avoid commiting deploy keys within the cookbook.
  
  > **Comments:**
  > **username_0**: Ssh_wrapper change will work with this. But main issue is for deploy_key path  
  > **username_1**: What is the problem using another cookbook_file resource for deploy_key ?  
  
  ---
  
  