For context, I am trying to create a deploy script on my local machine (A) to deploy my code to a remote server (B). I don't have root access on B.
Here are the contents of my bash script pertaining to this:
ssh $SSH_ENDPOINT /bin/bash << EOF
cd ~/$PROJECT
git pull
I can ssh
in successfully, then cd
into the directory. However, git pull
fails with:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
On both A and B, I have set up SSH with GitHub and it works fine, I can push and pull without having to enter any passphrase or anything of the sort.
I'm not completely sure why this error is being thrown as both public keys should work.
EDIT: Doing -vv
with ssh
gives:
debug2: channel 0: rcvd ext data 32
Permission denied (publickey).
debug2: channel 0: written 32 to efd 6
debug2: channel 0: rcvd ext data 126
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Not quite sure how to proceed from here.