I’m writing a bash script that includes clone a private repository using SSH,
the problem is when i write git clone ... directly in the terminal, it works fine
but in the bash script it’s also written git clone ... but it gives error
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
any thoughts of what the problem could be?
even if the file contains only:
sudo git clone git@github.com:username/Project.git
I figured out what the problem was, i just tried echo $USER in both and they are not the same, the one in the file is root, so i removed the sudo from sudo bash file.sh and it worked fine