I can't get GitLab CI to ssh into my remote server via a bash script

I have a shell runner set up that is supposed to run a small bash script in order to deploy my code. If I sudo su gitlab_ci_multi_runner I can run the ssh command in the script just fine. But every time CI runs it, it errors.

Permission denied (publickey).

The deploy job is just:

bash ./scripts/deploy

My remote server has password authentication disabled. In the bash script I’ve explicitly told ssh NOT to use password auth via the -o flag.

I configured /home/gitlab_ci_multi_runner/.bashrc to ssh-add the correct private key files for the remote user.

The only thing I can think of is that CI isn’t actually loading the shell in a way that would trigger .bashrc… Is that the case?