Issue
I have a private repository on GitHub and my goal is that whenever there is a new commit, the repository us updated on the VPS.
The issue with this is that the repository is private and requires authentication. I tried settings my username and password in the global git config but even after doing that it still requires authentication.
Solution
Figured out the solution on my own. The issue with the various things I was doing was as follows. I was trying to do something along the lines of git pull https://${{ secrets.TOKEN }}@github.com/repo
The solution was putting the entire command git pull https://[email protected]/repo
as a secret and then running the script: ${{ secrets.SCRIPT }}
via SSH.
My action at the end of this:
name: Remote SSH
on: [push]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP }}
username: ${{ secrets.USER }}
password: ${{ secrets.PRIVATE_KEY }}
port: ${{ secrets.PORT }}
script: |
cd Repository
${{ secrets.SCRIPT}}
pm2 restart 0
Answered By - factor