I'm using Raspbian.
I did successfully added the key and I can clone a private repo with ssh auth manually, using the command git clone [email protected]:USER/repo.git.
Here is how I set it up:
ssh-keygen -t rsa -b 4096 -C “email”
eval "$(ssh-agent -s)"
ssh-add -k ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
However, if I try to run git clone command through a bash script, I get Permission denied (publickey).
I'm running the script as "pi", with sudo. The script starts with #! /bin/bash and whoami (on the script) returns root, instead of "pi".
Could someone help me out, please?
Thanks!