gh-pages not overwriting global user when deploying with `user`
Opened this issue · 1 comments
When I deploy using gh-pages, I want to deploy as a user that is not the globally figured user(frzyc), since I don't have access to the repo as my global user. However, I seem to have trouble getting the user overwrite to work, either programmatically, or using the CLI.
in my package.json
:
"deploy": "gh-pages -d build --user \"DevTwo <DevTwo@users.noreply.github.com>\" -r https://github.com/DevTwo/pages",
remote: Permission to DevTwo/pages.git denied to frzyc.
fatal: unable to access 'https://github.com/DevTwo/pages/': The requested URL returned error: 403
Or when I try to deploy using code:
var ghpages = require('gh-pages');
ghpages.publish('build', {
branch: "gh-pages",
repo: "https://github.com/DevTwo/pages",
user: {
name: 'DevTwo',
email: 'DevTwo@users.noreply.github.com'
}
}, console.log);
ProcessError: remote: Permission to DevTwo/pages.git denied to frzyc.
fatal: unable to access 'https://github.com/DevTwo/pages/': The requested URL returned error: 403
at ChildProcess.<anonymous> (...\node_modules\gh-pages\lib\git.js:42:16)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
code: 128
}
@frzyc I had the same issue with a fresh new repository. I have multiple older repositories which worked just fine.
I was able to get the deployment working after checking a setting in repository settings from Settings - Actions - General - Workflow permissions
, check Read and write permissions
and click Save.
If the radio box above is disabled, e.g. in organization repositories, you can defined following in the workflow file:
permissions:
contents: write