title: git pull into bash script
body: <p>I try run bush script with <code>git pull</code> but have Permission denied.</p>
  
  <p>Run:</p>
  
  <pre><code> sudo bash ./script.sh
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>echo -n "Would you like to do 'git pull' (\"y\" or \"n\", default: \"n\"): "
  read answer
  if [ "$answer" = "y" ]; then
     if ! git pull origin master; then
        echo "Pull conflicts!"
        exit
     fi
  fi
  </code></pre>
  
  <p>And have:</p>
  
  <pre><code>Permission denied (publickey).
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
  Pull conflicts!
  </code></pre>
  
  <p>Access right to ssh key:</p>
  
  <pre><code>drwx------ 2 ubuntu ubuntu 4096 Dec 13 02:32 .
  drwxr-xr-x 8 ubuntu ubuntu 4096 Dec 13 02:05 ..
  -rw------- 1 ubuntu ubuntu  390 Oct  8 07:13 authorized_keys
  -rw------- 1 ubuntu ubuntu 1679 Dec 13 01:58 id_rsa
  -rw-r--r-- 1 ubuntu ubuntu  405 Dec 13 01:58 id_rsa.pub
  -rw------- 1 ubuntu ubuntu 1767 Dec 13 02:16 known_hosts
  </code></pre>
  
  <p>How fix this?</p>
  
  <p>P.S. When I run <code>git pull origin master</code> in terminal - everything is OK</p>