Reputation: 13500
I am part of an organization that uses SSO in Github. I don't have problem to access the repository through the web, it redirects me to SSO login and that's all.
The problem started when I logged-in first to my personal repository on GitHub through Git-Bash, I did some changes and then I wanted to do changes in a repository from my organization. When I run the below command, it wrote me that I need to re-authorize the OAuth Application, but I don't understand how:
$ git push --delete origin v0.1.3
remote: The `<my_company>' organization has enabled or enforced SAML SSO. To access
remote: this repository, you must re-authorize the OAuth Application `Git Credential Manager`.
fatal: unable to access 'https://github.com/<my_company>/myproj.git/': The requested URL returned error: 403
How can I re-authorize the login?
I tried to re-open Git-Bash but it wrote me the same error.
Upvotes: 141
Views: 203010
Reputation: 3984
All I needed to do was
gh auth refresh
when I got the broadly similar message:
remote: To access this repository, you must re-authorize the OAuth Application 'GitHub CLI'.
Upvotes: 2
Reputation: 13602
On Windows, accessed Credential Manager (on Mac should be Keychain Access)
Then, in Windows Credentials, removed all that started with git:
With that, after running git fetch
in Git Bash in the same directory, this opened up (I have GitHub CLI installed - it might be required)
Then clicked Sign in with your browser
(if one's default browser is not the one we are logged in, copy the URL, close the tab, and paste the URL in the browser one is logged in).
Now one should be able to interact without any problem.
And if one checks the Mredential Manager, one should see a new one in Windows Credentials (one might have to click "Web Credentials" then click back "Windows Credentials").
Upvotes: 4
Reputation: 314
At least on Windows, it worked for me to simply trigger re-authentication using
git credential-manager github login
.
Upvotes: 8
Reputation: 46480
I had this problem on a Mac. The solution was to re-authenticate with GitHub:
$(git config --global credential.helper) github login
Upvotes: 3
Reputation: 667
In my case Authorisation was revoked and access was given back. Now, Organisation authorisation was missing.
To enable it back, Follow the steps •
After all this step open your terminal or command line tool
run below commands
brew install gh
(if gh is not installed)
gh auth login
Follow the instruction and select https if you already cloned using https
.
That's it. Happy coding :)
Upvotes: 1
Reputation: 44
In Visual studio code, click on profile icon and signout of git. Then login to github, go to settings > Applications > Authorized Oauth Apps. Revoke "VS code" and "Windows Credentials Manager".
In Windows, search for "Credentials Manager" app and delete "git:".
Now clone freshly from VS code and terminal(git clone). Authorize from browser in github. Now, you will re-authorized in both VS Code and command line.
Upvotes: 0
Reputation: 859
For VSCode users or any other IDE you need to force GitHub to re-authorize the app!
If you then sign out in VSCode and sign in again, you should be prompted to re-authorized.
Upvotes: 35
Reputation: 649
For Visual Studio 2022, Click your profile icon, select Account Settings and then remove and re-add your GitHub credentials
Upvotes: 14
Reputation: 3205
This works for me by revoking the current application in the Github Settings > Settings > Applications > Authorized OAuth Apps
and then try the git pull
again.
Upvotes: 6
Reputation: 1377
I used the Github cli by running the following in the terminal
gh auth login
which then prompted me to re-authenticate, and I was able to.
If you do not have the CLI (Command Line Interface) currently installed, you can visit https://cli.github.com/ for more information. There is a download for Mac.
Upvotes: 95
Reputation: 389
Delete git from "credential manager" window's application. Then pull on repo again. The sso authentication should automatically come up.
Upvotes: 23
Reputation: 4209
My company just enabled SSO for my Github Org overnight so was getting the same error running git pull
. I fixed this with the following steps.
git config --global credential.helper manager-core
git pull
and follow the pop-up instructions to authenticate in a browser (which happened automatically for me with SSO).After those steps git commands worked for me again.
Upvotes: 170