peterkimzz / aws-ssm-send-command

Github Actions for using AWS SSM Send-Command
MIT License
61 stars 32 forks source link

AWS SSM command gets execute but latest git changes are not sync from private repo. #11

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi, I'm using private git repository, when I make any changes and commit the change to git repo, action start and on aws ubuntu server ./deploy.sh file executing but git pull origin main doesn't get the latest changes from origin main repo.

I have clone this repository using ssh git@github.com:xxx/xxx.git. also added id-res.pub key into my github account, even generated Personal Access Token.

By manually executing ./deploy.sh on ubuntu terminal window works fine.

Also, I tried the same with public repository it works as expected but private repo it doesn't get the latest changes rest all statement execute from ./deploy.sh

git pull origin main cd client sudo npm install sudo npm run-script build cd .. sudo docker-compose build --no-cache sudo docker-compose stop sudo docker-compose up --force-recreate -d

ghost commented 3 years ago

I was able to resolve this by using below steps.

  1. chmod 400 path-to-private-key-file
  2. I changed deploy.sh to #!/bin/sh git config core.sshCommand 'ssh -i /home/ubuntu/.ssh/id_rsa' && \ git pull origin master && \ sudo docker-compose up --build -d