This error occurs when your Git credential (SSH key or Personal Access Token) hasn't been authorized for an organization that uses SAML Single Sign-On. You need to authorize your credential through GitHub's settings after authenticating with your organization's identity provider.
This error indicates that the GitHub organization you're trying to access has enabled SAML Single Sign-On (SSO) for enhanced security. SAML SSO requires members to authenticate through the organization's identity provider (IdP) such as Okta, Azure AD, or OneLogin before accessing resources. When SAML SSO is enabled, your existing SSH keys and Personal Access Tokens need explicit authorization for that organization. Even if your credentials work for other repositories, they won't work for SSO-protected organizations until you complete the authorization step. The error typically appears when: 1. You're pushing, pulling, or cloning from an organization repository for the first time after SSO was enabled 2. Your credential authorization was revoked by an organization admin 3. You're using a new SSH key or PAT that hasn't been authorized yet 4. You haven't completed the SAML authentication with the organization's identity provider
Before you can authorize credentials, you must have a "linked external identity" by authenticating through your organization's IdP at least once:
1. Go to your organization's GitHub page: https://github.com/YOUR_ORG_NAME
2. You should see a prompt to authenticate via SSO
3. Click Continue or Authorize to be redirected to your IdP (Okta, Azure AD, etc.)
4. Complete the SSO login with your corporate credentials
5. After successful authentication, you'll be redirected back to GitHub
If you don't see the SSO prompt:
- Go to [github.com/settings/organizations](https://github.com/settings/organizations)
- Find the organization and click on it
- Look for a "SAML single sign-on" banner and complete authentication
This creates the linked identity that's required before you can authorize any credentials.
If you're using HTTPS authentication with a Personal Access Token (PAT), you need to authorize it for each SSO-enabled organization:
For existing tokens:
1. Go to [github.com/settings/tokens](https://github.com/settings/tokens)
2. Find the token you're using (check token names/descriptions)
3. Click Configure SSO next to the token
4. Find your organization in the dropdown
5. Click Authorize next to the organization name
6. You may be prompted to re-authenticate with your IdP
Creating a new token with SSO authorization:
1. Go to [github.com/settings/tokens](https://github.com/settings/tokens)
2. Click Generate new token > Generate new token (classic)
3. Set name, expiration, and required scopes (repo for repository access)
4. Click Generate token
5. Immediately click Configure SSO on the new token
6. Authorize it for your organization
Note: Fine-grained PATs are authorized during creation - you must select the SSO-protected organization when creating the token.
After authorization, retry your Git command:
git push origin mainIf you're using SSH authentication, you need to authorize your SSH key for SSO-enabled organizations:
1. Go to [github.com/settings/keys](https://github.com/settings/keys)
2. Find the SSH key you're using for Git operations
3. Click Configure SSO next to the key
- If you don't see this option, ensure you've authenticated via SSO at least once (Step 1)
4. Find your organization in the dropdown
5. Click Authorize next to the organization name
Verify your SSH key is working:
# Test SSH connection
ssh -T [email protected]
# Should show: Hi username! You've successfully authenticated...If the key was revoked:
If an organization admin revoked your SSH key's authorization, you cannot re-authorize that same key. You must:
# Generate a new SSH key
ssh-keygen -t ed25519 -C "[email protected]"
# Add to SSH agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
# Copy public key
cat ~/.ssh/id_ed25519.pubThen add the new key to GitHub and authorize it for SSO.
If you're still seeing the error, cached credentials may need to be cleared so you can re-authenticate:
Windows (Credential Manager):
# Open Credential Manager
control /name Microsoft.CredentialManager
# Or via command line
cmdkey /delete:git:https://github.com1. Open Control Panel > Credential Manager > Windows Credentials
2. Find and remove entries for git:https://github.com or github.com
3. Try your Git command again - you'll be prompted to re-authenticate
macOS (Keychain):
# Remove GitHub credentials from Keychain
git credential-osxkeychain erase
host=github.com
protocol=https
# Press Enter twice
# Or open Keychain Access app and delete github.com entriesLinux:
# If using credential store
rm ~/.git-credentials
# If using GNOME Keyring
# Open Seahorse (Passwords and Keys) and remove GitHub entriesGit Credential Manager:
# Re-initialize GCM
git credential-manager unconfigure
git credential-manager configureAfter clearing, the SSO authentication flow should automatically appear when you next try to push or pull.
For automated systems like GitHub Actions, Jenkins, or other CI/CD tools accessing SSO-protected repositories:
GitHub Actions (same organization):
- The built-in GITHUB_TOKEN automatically works for repositories in the same organization
- No additional SSO configuration needed
GitHub Actions (cross-organization access):
# Use a PAT that's been authorized for SSO
steps:
- uses: actions/checkout@v4
with:
repository: other-org/repo
token: ${{ secrets.SSO_AUTHORIZED_PAT }}The PAT stored in secrets must be:
1. Created by a user who has SSO access to the organization
2. Authorized for SSO (Configure SSO > Authorize)
3. Have required scopes (repo for private repositories)
Other CI/CD systems:
1. Create a dedicated service account or use a team member's credentials
2. Generate a PAT with appropriate scopes
3. Authorize the PAT for SSO
4. Store the token securely in your CI/CD platform's secrets management
5. Update your pipeline to use HTTPS with the token:
git clone https://x-access-token:${TOKEN}@github.com/org/repo.gitDeploy keys:
Deploy keys set up on individual repositories don't require SSO authorization - they're scoped to that specific repository.
Confirm your credentials are properly authorized for SSO:
Check token authorization:
1. Go to [github.com/settings/tokens](https://github.com/settings/tokens)
2. Find your token
3. Look for a green checkmark or "Enabled" next to the organization name under SSO
Check SSH key authorization:
1. Go to [github.com/settings/keys](https://github.com/settings/keys)
2. Find your SSH key
3. Look for "Enabled" status next to your organization
Check organization membership:
1. Go to [github.com/settings/organizations](https://github.com/settings/organizations)
2. Verify you're a member of the organization
3. Check for any pending SSO authentication requirements
Test access:
# For HTTPS
git ls-remote https://github.com/ORG_NAME/REPO_NAME.git
# For SSH
git ls-remote [email protected]:ORG_NAME/REPO_NAME.gitIf these commands succeed, your credentials are properly authorized.
### Understanding SAML SSO in GitHub
SAML SSO adds an extra layer of security for organizations. When enabled:
- Users must authenticate through the organization's IdP before accessing resources
- All credentials (SSH keys, PATs) must be explicitly authorized for that organization
- Organization admins can enforce SSO, revoke access, and audit authentication
### Linked External Identity
A "linked external identity" is created when you first authenticate via SSO. This links your GitHub account to your corporate identity. Without this link, you cannot authorize credentials for SSO:
GitHub Account ←→ External Identity (via IdP) ←→ Organization Access### IP Allow List Considerations
Some organizations configure IP allow lists at the enterprise level. If you're authorized for SSO but still can't access:
- Verify your IP address is in the organization's allow list
- Contact your GitHub organization admin to check enterprise-level restrictions
- VPN or corporate network may be required
### Token Types and SSO
| Token Type | SSO Behavior |
|------------|--------------|
| Classic PAT | Authorize after creation via "Configure SSO" |
| Fine-grained PAT | Select organization during token creation |
| OAuth tokens | Automatic authorization when granting access |
| GITHUB_TOKEN | Automatic for same-org Actions |
| Deploy keys | No SSO authorization needed (repo-scoped) |
### Common Enterprise Scenarios
Multiple organizations with SSO:
You may need to authorize the same credential for multiple organizations separately. Each SSO-enabled org requires its own authorization.
Organization ownership changes:
If your organization ownership changes or SSO settings are modified, you may need to re-authorize your credentials.
Session expiration:
SSO sessions can expire based on IdP settings. You may need to periodically re-authenticate through your identity provider.
### Git Credential Manager and SSO
Git Credential Manager (GCM) handles SSO authentication flows automatically in most cases:
# Check GCM version
git credential-manager --version
# GCM will automatically prompt for SSO authentication when needed
# The authorization is stored and reused for future operationsIf GCM isn't prompting for SSO:
# Force re-authentication
git credential-manager unconfigure
git credential-manager configure### Revoking and Re-authorizing
If authorization was revoked:
- PATs: Can be re-authorized via Configure SSO
- SSH keys: Cannot be re-authorized - must create a new key
Preemptive de-authorization:
If you're leaving an organization or a project, de-authorize your credentials:
1. Go to Settings > SSH and GPG keys (or Personal access tokens)
2. Click Configure SSO
3. Click "Revoke" next to the organization
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git