0

I have a repository https://github.com/Gitauwairimu/ghjavamvn.git whose github actions workflow builds and pushes a docker image. It also checkouts another repo https://github.com/Gitauwairimu/GitOps--ghjavamvn.git and successfully updates a file base/base/deployment.yaml with the new image. How can this changes be pushed back to the repo https://github.com/Gitauwairimu/GitOps--ghjavamvn.git using git?

Am using:

    git config user.name "me"
    git config user.email "xxxx@gmail.com"
    git add base/deployment.yaml
    git commit -m 'updated k8s manifest image version'
    git push https://${{ secrets.k8s_REPO_UPDATE }}@github.com/Gitauwairimu/GitOps--ghjavamvn.git
    git push origin main

Its not working. The issue seems to be the second last command.

Gitau Wairimu
  • 11
  • 1
  • 4
  • Could you share the rest of your workflow to see how you checkout both repositories? – GuiFalourd Jul 14 '23 at 11:01
  • - name: Checkout K8s manifest repo uses: actions/checkout@v2 with: repository: Gitauwairimu/GitOps--ghjavamvn ref: 'main' token: ${{ secrets.GITHUB_TOKEN }} path: ./base env: GITHUB_TOKEN: ${{ secrets.k8s_REPO_UPDATE }}`` – Gitau Wairimu Jul 14 '23 at 20:17
  • Its a public repo. Find the workflow file here: https://github.com/Gitauwairimu/ghjavamvn/blob/main/.github/workflows/deploy.yaml @GuiFalourd – Gitau Wairimu Jul 14 '23 at 22:40
  • locally cloning the repo, updating files and using the same processing in pushing changes works – Gitau Wairimu Jul 15 '23 at 08:48
  • What happens when executing directly `git push origin main` ? – GuiFalourd Jul 15 '23 at 17:29
  • I am then prompted to key i my Github login details but from my local machine am successful in pushing the git changes when I use: git push https://@github.com//Gitauwairimu/GitOps--ghjavamvn.git -f – Gitau Wairimu Jul 15 '23 at 20:26
  • What is the `ACTIONS_RUNNER_TOKEN` secret scope permission? Moreover, you shared `github.com//Gitauwairimu` in the URL, but it should be `github.com/Gitauwairimu` (with `/` and not `//`). – GuiFalourd Jul 15 '23 at 22:09
  • I have rectified that. Now I get: fatal: could not read Password for 'https://***@github.com': No such device or address – Gitau Wairimu Jul 15 '23 at 23:00
  • I have given all repo and workflow permisions to the token. I now get the error: error: src refspec https://Gitauwairimu does not match any error: failed to push some refs to 'https://github.com/Gitauwairimu/GitOps--ghjavamvn' Error: Process completed with exit code 1. – Gitau Wairimu Jul 16 '23 at 01:29

0 Answers0