How to resolve "refusing to allow an OAuth App to create or update workflow" on git push
GitGithubGithub ActionsGit Problem Overview
Getting
> refusing to allow an OAuth App to create or update workflow .github/workflows/cd.yml
without workflow
scope"
on git push
. How to grant workflow
scope?
Git Solutions
Solution 1 - Git
I've literally just come across this problem when trying to use IntelliJ to push to a branch that contains a GitHub Action workflow (YAML
file in .github/workflows). I didn't find existing resources on the Internet very helpful, so I hope this will help you fix it too.
TL;DR: Generate a new Personal Access Token with the workflow
scope enabled in GitHub and configure your application to use that.
Background: third-party tools with GitHub integrations like IntelliJ, Visual Studio Code, Github Desktop, etc use tokens to connect to your GitHub account so they can pull/push, etc on your behalf. In the case of IntelliJ, their instructions only say to include the repo
, the gist
, and the read:org
scopes. But you need the workflow
scope to modify GitHub Actions.
Here's how to fix it:
- In your Github account, go to Settings (in your avatar dropdown in the top right-hand corner)
- Go to Developer Settings > Personal Access Tokens
- If your application is listed, click on its name to edit the settings associated with its token. Make sure
workflow
is ticked. - Click on Update Token to save the change.
- On the same page, click on Generate Token. Read the information carefully, then click OK to continue.
- Copy the new token that Github shows you.
- You will need to recreate your application's integration with Github using the new token for the change to take effect.
Note: you may be able to skip steps 5 onward if your application refreshes its permissions automatically, but that didn't seem to work for me with IntelliJ.
In IntelliJ, the last step was to go to Settings > Version Control > GitHub, then remove the existing integration and re-add it, pasting in the new token. You'll have to find out what needs to be done for the tool you're using to give it the new GitHub Personal Access Token.
Solution 2 - Git
For Windows 10: Go to Settings -> Credentials Manager -> Windows Credentials -> Remove github.com credentials -> git pull/push your github project from git-bash console -> Reconnect GitHub Account in your IDE/Source control. You don't need create Personal Access Token with "workflow", you don';t need create secret GITHUB_TOKEN (it creates auto and can't created manual)
Solution 3 - Git
Running macOS Big Sur. I am pushing my .yml
workflow file from the Atom text editor and this worked for me.
- Go to github personal access tokens settings and generate a new token. Make sure you select both repo and workflow access scope.
- Go to Keychain Access app on Mac, and search for github. I found an entry (shown below) named
github.com
, ofInternet password
kind, which was previously filled with a seemingly random token. Replace the password entry with the generated token (the one begins withghp_
) from step 1.
Solution 4 - Git
This issue also happens simply because your current token is not allowed to work with workflow on Github. Do the following steps to fix
For people using Android Studio on MacOS:
remember to hit the "Ok" button.
Solution 5 - Git
In my case, I had stale GitHub credentials in macOS Keychain. I was modifying a workflows file and pushing the changes from the command line, hence I didn't think of checking the Keychain at all. The Updating credentials from the macOS Keychain explained how to use git credential-osxkeychain
to erase the Keychain:
$ git credential-osxkeychain erase
host=github.com
protocol=https
> [Press Return]
I then had to enter my username and password again. This time I generated a new personal access token and used that token for the password. Then I could finally push the workflows changes.
Solution 6 - Git
On Windows 10 Here is step by step how I was able to fix the issue
I've included lots of screenshots `cause this was way harder to resolve then it should have been.
In hind sight, what @CSRedRat said is right but as I was having the problem I couldn't understand that because the answer was so terse.
Ultimately what led me to the solution was this article which makes the situation more clear.
Here's the deal. While you can work around this issue using the GitHub Developer Settings Menu to generate a new token and then pasting that into the Windows Credential Manager, you shouldn't because eventually that token will expire and then you will be having this issue again since nothing will know how to refresh the token since you set it manually.
Instead, this token privs issue needs fixed via Git for Windows. So the deal is the "old" Git Credential Manager for Windows didn't ask for privs to create or update workflows but now you need them. The good news is there is a new version our called Git Credential Manager Core and it does ask for these privs and more.
The new credential manager ships with Git 2.28 and later, but isn't enabled by default. If you already have Git for Window of this version or later installed then you already have the software even. In my case I had version 2.30.2 so I already had the new software.
But it was still using my old Git for Windows credentials which don't carry the privs needed. That may be your case as well or if you don't have a version older 2.28 then you need to first install a newer version. Either way, once you have a new enough version of Git for Windows on your machine the next step is to remove the old credentials by typing "windows credential manager" in the windows search box.
Then find each git credential, click on it and click the remove button.
Now next time you try to access your get account from git bash
Visual Studio or whatever git client you use, you will be prompted for new credentials because the old ones are gone. Click the Sign in with your browser
button in the dialog below:
Then you will see a web page like this one below, and if you expand the workflow drop down you will see it is asking for the privs you need this time. Then click Authorize
button.
Once you do that, you will see a page like this for providing your github password:
Now you have a new credential in your windows credential manager that has the privs you need and your operation that use to fail will now succeed. Yea!
Solution 7 - Git
Fixed this by using the Desktop Github App
for pushing my changes (it seems to have full permissions vs. the limited scope of vs code).
After getting that one commit with the modified workflow file pushed through, I was able to make push commits normally again in vs code
.
Solution 8 - Git
I had this issue with CLion 2020.2.3 while attempting to push a change to .\github\workflows\build.yml. CLion appears to use the "JetBrains IDE Integration" token (GitHub Settings -> Applications -> Authorized OAuth Apps) which does not include the "workflow" scope. There does not appear to be a way to change the scope of this token.
I created a new Personal Access Token with the correct permissions (GitHub Settings -> Developer settings -> Personal access tokens -> Generate new token), but I was unable to configure CLion to use it.
Ultimately I was able to push the commit using GitHub Desktop instead.
Solution 9 - Git
This happened to me on GitKraken. I simply disconnected and reconnected GitHub from GitKraken and it worked.
Solution 10 - Git
I followed this article to install Git Credential Manager Core to handle this automatically - and it works well for me (macOS):
Using homebrew:
brew tap microsoft/git
brew install --cask git-credential-manager-core
Solution 11 - Git
I had to upgrade my Git For Windows to version 2.29.2.2. That allowed the git command line to sign in through the browser, which GitHub now requires.
I did this after trying a Windows Credential Manager reset and regenerating my Personal Access Token, which didn't resolve it. But it did cause GitHub to send me an email like this:
> [GitHub] Action required - Password authentication in Git for Windows is no longer supported > > We have detected that you recently attempted to authenticate to GitHub using an older version of Git for Windows. GitHub has changed how users authenticate when using Git for Windows, and now requires the use of a web browser to authenticate to GitHub. To be able to login via web browser, users need to update to the latest version of Git for Windows.
Solution 12 - Git
This happened to me on PHPStorm. I was trying to use the IDE to commit and push my alterations, so when i got the error, i tried to push with command line on IDE console and i got it.
Solution 13 - Git
For IntelliJ IDE users, follow these simple steps:
- Go to Files > Settings > Version Control > Github and remove the Github account by clicking on the account and then on the '-' button.
- Then Sign in to Github.com in your default browser & then click on the '+' button on the same IDE window we opened in step 1. Then select 'Login with token'.
- Click on the Generate Button.
- This will open a GitHub page in your browser with all the permission prefilled. All you have to do is click on 'Generate Token' at the bottom of the page. Then use that token to fill it in the IDE pop-up window.
- Close the settings window & push your code again. This always works for me.