title: How to use SSH key to deploy angular production build to an external server using bitbucket pipeline?
body: <p>We are trying to use Bitbucket Pipelines to deploy a basic angular application to a VM on Google Cloud but are not sure how to use SSH key to connect to the server to copy the build files. Looking for examples but could not find.</p>
  
  <p>We were able to do the same manually using Putty/SSH commands to copy the <strong>dist</strong> files.</p>
  
  <p>We have the public/private key from Google Cloud's VM, and added them to Bitbucket Pipelines > SSH Keys</p>
  
  <p><a href="https://i.stack.imgur.com/a6YMR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a6YMR.png" alt="enter image description here"></a></p>
  
  <p>Our YML script is as below:</p>
  
  <pre><code>image: node:6.9.4
  
  pipelines:
    default:
      - step:
         caches:
           - node
         script: # Modify the commands below to build your repository.
           - npm install
           - npm install -g @angular/cli@1.6.4
           - ng build --prod
           - cd dist/
           - ssh -i ???
  </code></pre>