I was adding a GitHub workflow to a template project recently and hit on this error:
(refusing to allow an OAuth App to create or update workflow `.github/workflows/node.js.yml` without `workflow` scope)
Basically not allowed to do what I wanted with just username and password level credentials. After a bit of faffing this process worked:
1. Go to Settings > Developer Settings > Personal access tokens in GitHub's account level settings and generate a new token. Give it the permissions you require (in my case I had to add Workflow as well as Repo)
2. Go to the root of your project and execute git remote -v
to see your current remote origin.
3. Now remove it with git remote rm origin
and re-run git remote -v
to check it's gone.
4. Now add your new remote in the following format git remote add origin https://[USERNAME]:[PERSONAL_ACCESS_TOKEN]@github.com/[USERNAME/ORGANIZATION]/[REPONAME].git
.
5. Re-run git remote -v
to check it's added.
6. You will need to re-add the origin in your next push git push -u origin [BRANCH_NAME]
but this time it will pass.
You may need to reset your main upstream branch git branch --set-upstream-to=origin/master master