Error when pushing using personal access token -- the requested URL returned error: 403
See original GitHub issueContext: Was checking out multiple private repos and was copying a file from a private repos to a public repos in the workspace, then committing and pushing. The push would fail with a 403.
Error:
remote: Permission to my-repos denied to github-actions[bot].
fatal: unable to access 'https://github.com/.../my-repos.git/': The requested URL returned error: 403
By running this command we can see any of config settings being used for our repos:
git config -l
We discovered the checkout action is executing a command like this:
git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
Reference: https://github.com/actions/checkout/blob/master/adrs/0153-checkout-v2.md#pat
The fix is to do this:
git config --local --unset-all "http.https://github.com/.extraheader"
It’s seems unlikely that this could lead to side effects but it may be desirable to re-set this value after the push is completed.
Sorry for lack of PR, we ended up not using your action and just incorporated what we ended into our workflow file.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:7 (2 by maintainers)
Top Results From Across the Web
git - GitHub's personal access token not working?
I have tried everything mentioned in this thread: Pushing to Git returning Error Code 403 fatal: HTTP request failed.
Read more >Solving Github Password Authentication 403 Errors
Generating A Personal Access Token On Github. This is the easy part. Simply go to the following URL : https://github.com/settings/tokens, and ...
Read more >Sourcetree ignores github token and throws 403 error
To prevent this after removing the old git credentials, delete Atlassian folder from all the appdata folders. Then go to Tools->Settings->Authentication and add ......
Read more >Pushing to Git returning Error Code 403 fatal: HTTP request ...
Note that 403 means is an HTTP code that means forbidden. It implies that your URL exists, the server is working, but there...
Read more >Can't push to your GitHub repo? I can help with that.
Please use a personal access token instead. fatal: unable to access <git_repo>: The requested URL returned error: 403.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For me, I used
permissions: write-all
to make it work with my customgit push
command.Using the standalone and cross-platform “GCM” (Git Credential Manager) indirectly solved this problem for me (on a Windows 1O platform)
I installed it from this resource : https://github.com/microsoft/Git-Credential-Manager-Core/releases/tag/v2.0.498
(https://github.com/microsoft/Git-Credential-Manager-Core)
Once it is installed, the first push operation (or pull) displays a prompt allowing to reach the remote GitHub. It didn’t work well with the Personal Access Token, but this tool also allows to open the GitHub HTML page, by providing the “classic” username and password. It apparently stores the credentials in a cache. Commits and pushes both work with the Bash console and TortoiseGit. I’m not sure what happens when the token expires though…