This is my setup.
- My git repository is in bitbucket
- I have created keys on my remote aws ec2 server and kept it in
~/.ssh
folder - I then add the key via the ssh-agent on my remote server
- Updated these keys on the bitbucket website.
When I login to my remote server and run git pull
on my git repository everything works fine. No issues here.
But when I run the same the same via the cygwin bash on windows it gives me this error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I do the following on my windows machine
ssh -i xyz.pem user@ip -t 'sudo sh deploy.sh'
Where the deploy.sh
, cd's into my repository and does a git pull
.
Why is this issue happening ? Should I also keep these ssh keys on my windows machine? Any help will be invaluable.