I am trying to create a Release pipeline that:
- Updates the docker image in the docker-compose.yml that is a part of my deployment repository
- Logs via SSH to my server
- [On my remote server] fetches the latest deployment repository
- [On my remote server] runs the updated docker-compose.yml
I stuck on the point #1. I managed to get to the point where I have my repository available, I update the docker-compose.yml file (via bash script), I can commit the changes but unfortunately the push fails.
Here's my release pipeline with two artifacts:
- my build pipeline which I'm using to get the build number that I want to release
- my GitHub repository (since I'm using 2FA, I've linked it via Personal Token)
Here's my stage with three bash scripts - the first two are updating docker-compose.yml, the third one should commit the changes to the repository and push it.
Here's the result I'm getting when running the release:
It seems there's some problem with authentication when doing git push, but I'm not sure how to solve this. This SO suggests it's a problem with 2FA enabled on the git side, but since I'm using Personal Access Token to authenticate to git, 2FA should not be used. Even if I add this line to my script as suggested in that SO:
git config --global --add url."git@github.com:".insteadOf "https://github.com/"
It still fails with the following error:
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Could anyone guide me how to properly push git repository as a part of Azure release pipeline?