# 解決 GitHub Actions 部署到 GitHub Pages 遇到 Permission denied 的問題 ## 問題描述 在今年(2023)全新建立的專案,執行到 [JamesIves/github-pages-deploy-action](https://github.com/JamesIves/github-pages-deploy-action) 步驟時會失敗,根據 log 可以得知是在 GitHub Actions 執行到 `git push` 時遇到 403 錯誤。  > /usr/bin/git commit -m Deploying to page from @ ngseke/test@075776ff3f9a7b27bb5809efe605152205deabe5 🚀 --quiet --no-verify > **/usr/bin/git push** --force ***github.com/ngseke/test.git github-pages-deploy-action/8rb7mcfwb:page > remote: Permission to ngseke/test.git denied to github-actions[bot]. > fatal: unable to access 'https://github.com/ngseke/test.git/': The requested URL returned error: 403 這是 GitHub 在 2023 年 2 月的[這個變動](https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/)所導致的,原先 `GITHUB_TOKEN` 會一律預設得到 **read/write** 的權限,但後來改成了 **read-only** 才使得 `git push` 失敗,因此只需要手動調整權限即可。 現有專案則會維持原本的權限,不需要額外設定。 ## 解決方法 1. 到 Repository → **Settings** 分頁 → 左側欄 **Actions** → **General**  2. **Workflow permissions** 區塊 → 選中 **Read and write permissions** → 點擊 **Save**  3. 再次 Re-run workflow 應該就可以成功部署
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up