fatal: unable to access 'https://github.com/username/reponame.git/': The requested URL returned error: 403
背景
以下のようなgithub actionsワークフローでpushができなかった。
fatal: unable to access 'https://github.com/username/reponame.git/': The requested URL returned error: 403 がエラーメッセージ。
- name: ワークフロー名
env:
PAT: ${{ secrets.ACTIONS_PAT }}
run: |
git remote set-url origin https://x-access-token:${PAT}@github.com/username/reponame.git
git push origin main
解決策
「Settings」 > 「Actions」 > 「General」の、
Workflow permissions の設定を、
Read and write permissions に変更して解決。