Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-pages not overwriting global user when deploying with user #429

Open
frzyc opened this issue May 4, 2022 · 1 comment
Open

gh-pages not overwriting global user when deploying with user #429

frzyc opened this issue May 4, 2022 · 1 comment

Comments

@frzyc
Copy link

frzyc commented May 4, 2022

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 <[email protected]>\" -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: '[email protected]'
  }
}, 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
}
@AriPerkkio
Copy link

AriPerkkio commented May 15, 2022

@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.

image

If the radio box above is disabled, e.g. in organization repositories, you can defined following in the workflow file:

permissions:
  contents: write

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants