title: How to make a script to perform git pull?
body: <p>It is a common practice to perform <code>git pull</code> on <strong>dev</strong>/<strong>staging</strong>/<strong>production</strong> server(s). I frequently do so myself; I perform git pull almost 100 times a day on my production server running linux. </p>
  
  <p>I figure, it's time to make a <strong>script</strong> to improve that. </p>
  
  <hr>
  
  <p><strong>pull.sh</strong> will do these 3 commands</p>
  
  <ul>
  <li>git pull</li>
  <li>enter my-password (when prompt)</li>
  <li>service nginx reload</li>
  </ul>
  
  <hr>
  
  <p>I've tried create my <strong>pull.sh</strong> here </p>
  
  <pre><code>#!/bin/bash
  
  function pull {
    git pull
    password
    service nginx reload
  }
  
  
  pull ;
  </code></pre>
  
  <hr>
  
  <p><strong>Result</strong></p>
  
  <p>After running the script that I have, I still got prompt to input the password.</p>
  
  <p><a href="https://i.stack.imgur.com/zrHen.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zrHen.png" alt="enter image description here"></a></p>
  
  <hr>
  
  <p>Any hints / helps / suggestions will be much appreciated !</p>