This is my setup.
~/.ssh
folder 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.
Запустив sh
с sudo
, вы эффективно используете корневой каталог .ssh
учетные данные для доступа к репо. Они не совпадают с ключом, который вы сгенерировали и добавили в bitbucket.
Интересно, зачем вам вообще sudo
, может ли репозиторий записываться только root? Одним из вариантов может быть добавление ssh-ключа root в bitbucket или отказ от использования sudo
.