The command "git push --dry-run --no-verify [...]" failed with the error message remote: No anonymous write access.
I've been using semantic-release via GitHub Actions in one of my projects for many months now without any issue. For whatever reason, @semantic-release/github suddenly stopped working for me a few weeks ago. Running semantic-release would fail the release and print the following error to appear in the console:
The command "git push --dry-run --no-verify http://x-access-token:[secure]@github.com/jonahsnider/convert.git HEAD:master" failed with the error message remote: No anonymous write access.
fatal: Authentication failed for 'http://github.com/jonahsnider/convert.git/'.
I'm very lost as to why this is happening, I reviewed the commit history and didn't see anything that would have caused issues with semantic-release. The GitHub token is definitely present (defined using the GitHub Actions GITHUB_TOKEN secret), why does the error say it's not authenticated?
The full logs are shown below:
$ yarn workspace convert run release
[12:04:42 PM] [semantic-release] › ℹ Running semantic-release version 19.0.2
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/github"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "verifyConditions" from "@semantic-release/npm"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "prepare" from "@semantic-release/npm"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/github"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "publish" from "@semantic-release/npm"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/github"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "success" from "@semantic-release/github"
[12:04:42 PM] [semantic-release] › ✔ Loaded plugin "fail" from "@semantic-release/github"
[12:04:46 PM] [semantic-release] › ✔ Run automated release from branch master on repository http://x-access-token:[secure]@github.com/jonahsnider/convert.git
[12:04:46 PM] [semantic-release] › ✖ The command "git push --dry-run --no-verify http://x-access-token:[secure]@github.com/jonahsnider/convert.git HEAD:master" failed with the error message remote: No anonymous write access.
fatal: Authentication failed for 'http://github.com/jonahsnider/convert.git/'.
[12:04:46 PM] [semantic-release] › ℹ Start step "fail" of plugin "@semantic-release/github"
[12:04:46 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://api.github.com)
[12:04:47 PM] [semantic-release] [@semantic-release/github] › ℹ Found existing semantic-release issue #508.
[12:04:48 PM] [semantic-release] [@semantic-release/github] › ℹ Added comment to issue #508: https://github.com/jonahsnider/convert/issues/508#issuecomment-1144785041.
[12:04:48 PM] [semantic-release] › ✔ Completed step "fail" of plugin "@semantic-release/github"
[12:04:48 PM] [semantic-release] › ✖ EGITNOPERMISSION Cannot push to the Git repository.
semantic-release cannot push the version tag to the branch master on the remote Git repository with URL http://x-access-token:[secure]@github.com/jonahsnider/convert.git.
This can be caused by:
* a misconfiguration of the repositoryUrl (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#repositoryurl) option
* the repository being unavailable
* or missing push permission for the user configured via the Git credentials on your CI environment (https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication)
SemanticReleaseError: Cannot push to the Git repository.
at module.exports (/home/runner/work/convert/convert/node_modules/semantic-release/lib/get-error.js:6:10)
at run (/home/runner/work/convert/convert/node_modules/semantic-release/index.js:98:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async module.exports (/home/runner/work/convert/convert/node_modules/semantic-release/index.js:268:22)
at async module.exports (/home/runner/work/convert/convert/node_modules/semantic-release/cli.js:55:5) {
code: 'EGITNOPERMISSION',
details: '**semantic-release** cannot push the version tag to the branch `master` on the remote Git repository with URL `http://x-access-token:[secure]@github.com/jonahsnider/convert.git`.\n' +
'\n' +
'This can be caused by:\n' +
' - a misconfiguration of the [repositoryUrl](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#repositoryurl) option\n' +
' - the repository being unavailable\n' +
' - or missing push permission for the user configured via the [Git credentials on your CI environment](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication)',
semanticRelease: true
}
Seem to be linked to https://github.com/semantic-release/semantic-release/releases/tag/v19.0.3
This fixed version is already in the code base #510, we need to wait for a release.
I am also having the same issue.
Try this. Go to your repo/actions/general and it should look like this

I keep getting this error

i faced the same issue and solved it by adding the following permissions in my job
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
reference: https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/ci-configurations/github-actions.md