git pull (ssh public key) from script CentOS

I’m trying to create a bash script (CentOS 7) to pull code from bitbucket like this

#!/bin/bash PRJ=$  1 cd /var/$  PRJ git init git remote add origin$  PRJ.git git pull origin master npm install 

and i get the error

Permission denied (publickey). fatal: Could not read from remote repository. 

As you can see the remote is ssh with public key

if i try “git pull” inside the directory it works fine. Does running something ssh related from a script requires any special configuration or am i missing something?