How to fix fatal: Could not read from remote repository. Windows OpenSSH not properly configured in Git

GitINTERMEDIATEMEDIUMUpdated Dec 6, 2025· 242 views

This error occurs when Git on Windows cannot communicate with remote repositories because Windows OpenSSH is misconfigured or conflicts with Git's bundled SSH client. The fix involves configuring Git to use the correct SSH executable or properly setting up Windows OpenSSH.

Quick fix

Fixes fatal: Could not read from remote repository. Windows OpenSSH not properly configured

# Check Git's SSH command configuration
git config --get core.sshCommand

# Check the GIT_SSH environment variable
echo $env:GIT_SSH

# Find which ssh.exe is in your PATH
where.exe ssh
Get-Command ssh | Select-Object Source
  1. Check which SSH client Git is using
  2. Verify Windows OpenSSH installation status
  3. Configure and start the SSH Agent service
  4. Add your SSH key to Windows OpenSSH agent
git — error
# Check Git's SSH command configuration
git config --get core.sshCommand
# Check the GIT_SSH environment variable
echo $env:GIT_SSH
# Find which ssh.exe is in your PATH
where.exe ssh
Get-Command ssh | Select-Object Source
fatal: Could not read from remote repository. Windows OpenSSH not properly configured

What this error means

This error indicates that Git is attempting to use Windows OpenSSH for SSH connections to remote repositories, but the OpenSSH installation is not properly configured or is missing required components. Windows 10 and later include OpenSSH as an optional feature, but Git for Windows also bundles its own SSH client. When these two SSH implementations conflict or when Windows OpenSSH is partially installed, Git cannot establish SSH connections to remote hosts like GitHub, GitLab, or Bitbucket. The "fatal: Could not read from remote repository" portion confirms that Git was completely unable to access the remote repository because the SSH layer failed during connection setup.

Typical symptoms

  • Git clone, push, pull, or fetch operations fail when using SSH URLs
  • Error message mentions 'Windows OpenSSH not properly configured'
  • SSH commands work in PowerShell but fail in Git Bash
  • Git operations work with HTTPS URLs but fail with SSH URLs
  • The error appears after a Windows update or OpenSSH installation
  • Multiple SSH executables detected on the system
  • SSH agent service not running or inaccessible
  • Previously working Git SSH operations suddenly fail

Common causes

  1. Git is configured to use Windows OpenSSH, but the OpenSSH client is not installed or enabled
  2. Windows OpenSSH ssh-agent service is not running
  3. PATH environment variable has conflicting SSH executables
  4. Git's core.sshCommand points to a non-existent or misconfigured SSH binary
  5. SSH keys are stored in a location Windows OpenSSH doesn't check
  6. Permission issues with Windows OpenSSH accessing SSH keys
  7. Windows OpenSSH was partially uninstalled or corrupted
  8. Corporate Group Policy blocking OpenSSH components

How to fix "fatal: Could not read from remote repository. Windows OpenSSH not properly configured"

1Check which SSH client Git is using

First, determine which SSH executable Git is configured to use:

powershell
# Check Git's SSH command configuration
git config --get core.sshCommand

# Check the GIT_SSH environment variable
echo $env:GIT_SSH

# Find which ssh.exe is in your PATH
where.exe ssh
Get-Command ssh | Select-Object Source

Possible outputs:
- If core.sshCommand returns nothing, Git uses the default SSH
- Multiple ssh.exe paths indicate potential conflicts
- Common locations:
- C:\Windows\System32\OpenSSH\ssh.exe (Windows OpenSSH)
- C:\Program Files\Git\usr\bin\ssh.exe (Git for Windows bundled SSH)

2Verify Windows OpenSSH installation status

Check if Windows OpenSSH is properly installed:

powershell
# Check installed OpenSSH components (run as Administrator)
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

Expected output for properly installed OpenSSH:

bash
Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
State : NotPresent  # Server is optional

If OpenSSH.Client is not installed:

powershell
# Install OpenSSH Client (run as Administrator)
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

Verify the ssh.exe exists:

powershell
Test-Path "C:\Windows\System32\OpenSSH\ssh.exe"
3Configure and start the SSH Agent service

Windows OpenSSH requires the ssh-agent service to manage SSH keys:

powershell
# Check ssh-agent service status (run as Administrator)
Get-Service ssh-agent

# Set the service to start automatically
Set-Service -Name ssh-agent -StartupType Automatic

# Start the service
Start-Service ssh-agent

# Verify it's running
Get-Service ssh-agent

Expected output after starting:

bash
Status   Name               DisplayName
------   ----               -----------
Running  ssh-agent          OpenSSH Authentication Agent

If the service doesn't exist, Windows OpenSSH is not properly installed. Reinstall it using the steps above.

4Add your SSH key to Windows OpenSSH agent

Add your SSH private key to the Windows ssh-agent:

powershell
# Add your default SSH key
ssh-add $env:USERPROFILE\.ssh\id_ed25519

# Or for RSA keys
ssh-add $env:USERPROFILE\.ssh\id_rsa

# List loaded keys
ssh-add -l

If you get "Could not open a connection to your authentication agent":

powershell
# Ensure ssh-agent is running first
Start-Service ssh-agent

# Then try adding the key again
ssh-add $env:USERPROFILE\.ssh\id_ed25519

Verify the key location:

powershell
# Windows OpenSSH looks for keys here:
dir $env:USERPROFILE\.ssh

# Should contain:
# id_ed25519 (or id_rsa) - private key
# id_ed25519.pub (or id_rsa.pub) - public key
5Option A: Configure Git to use Windows OpenSSH

If you want Git to use the Windows OpenSSH client:

powershell
# Set Git to use Windows OpenSSH
git config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"

# Verify the setting
git config --get core.sshCommand

Test the connection:

powershell
# Test SSH to GitHub
ssh -T git@github.com

# Expected successful response:
# Hi username! You've successfully authenticated, but GitHub does not provide shell access.

Ensure PATH order is correct (Windows OpenSSH first):

powershell
# View current PATH
$env:PATH -split ';' | Select-String -Pattern "ssh|git" -CaseSensitive:$false

# Windows OpenSSH path should appear before Git paths
# C:\Windows\System32\OpenSSH should come before
# C:\Program Files\Git\usr\bin
6Option B: Configure Git to use Git's bundled SSH

If Windows OpenSSH continues to cause issues, configure Git to use its bundled SSH client instead:

powershell
# Set Git to use its bundled SSH
git config --global core.sshCommand "C:/Program Files/Git/usr/bin/ssh.exe"

# Or remove the setting entirely to use Git's default
git config --global --unset core.sshCommand

# Also clear any GIT_SSH environment variable
[Environment]::SetEnvironmentVariable("GIT_SSH", $null, "User")

Use Git Bash for SSH key management:

bash
# In Git Bash, start the ssh-agent
eval $(ssh-agent -s)

# Add your SSH key
ssh-add ~/.ssh/id_ed25519

# Test the connection
ssh -T git@github.com

This approach uses Git's bundled OpenSSH which is self-contained and doesn't depend on Windows OpenSSH configuration.

7Resolve PATH conflicts between SSH clients

If you have multiple SSH executables, ensure the correct one takes precedence:

powershell
# Find all ssh.exe in PATH
where.exe ssh

# Typical output with conflicts:
# C:\Windows\System32\OpenSSH\ssh.exe
# C:\Program Files\Git\usr\bin\ssh.exe

To modify PATH order permanently:

1. Open System Properties: sysdm.cpl
2. Click "Environment Variables"
3. Under "System variables", select "Path" and click "Edit"
4. Move the desired SSH path higher in the list

For Windows OpenSSH priority:
- C:\Windows\System32\OpenSSH should be above
- C:\Program Files\Git\usr\bin

For Git SSH priority:
- Reverse the order, or remove Windows OpenSSH from PATH

Verify the change:

powershell
# Restart PowerShell, then:
where.exe ssh
# The first result will be used
8Test the Git SSH connection

After making changes, verify Git can connect to your remote:

powershell
# Test SSH connection to GitHub
ssh -T git@github.com

# Test SSH connection to GitLab
ssh -T git@gitlab.com

# Verbose output for debugging
ssh -vT git@github.com

Test Git operations:

powershell
# Clone a repository
git clone git@github.com:username/repository.git

# Or test with an existing repository
cd your-repo
git fetch origin
git pull origin main

If still failing, check for detailed errors:

powershell
# Set GIT_SSH_COMMAND for verbose output
$env:GIT_SSH_COMMAND = "ssh -vvv"
git fetch origin

Advanced notes

### Understanding SSH Client Precedence on Windows

Git determines which SSH client to use in this order:

1. core.sshCommand Git configuration
2. GIT_SSH_COMMAND environment variable
3. GIT_SSH environment variable
4. First ssh.exe found in PATH

Check all of these:

powershell
git config --get core.sshCommand
echo $env:GIT_SSH_COMMAND
echo $env:GIT_SSH
where.exe ssh

### Windows OpenSSH vs Git's SSH - Key Differences

| Aspect | Windows OpenSSH | Git's Bundled SSH |
|--------|----------------|-------------------|
| Location | C:\Windows\System32\OpenSSH | C:\Program Files\Git\usr\bin |
| Agent | Windows Service (ssh-agent) | Shell process (eval ssh-agent) |
| Key Location | %USERPROFILE%\.ssh | ~/.ssh (Git Bash) |
| Config | %USERPROFILE%\.ssh\config | ~/.ssh/config |

### Key Storage Differences

Windows OpenSSH and Git's SSH may look for keys in different locations:

powershell
# Windows OpenSSH default key locations:
# C:\Users\YourName\.ssh\id_ed25519
# C:\Users\YourName\.ssh\id_rsa

# Git Bash interprets ~ as:
# /c/Users/YourName/.ssh/id_ed25519
# Which is the same physical location

### Troubleshooting ssh-agent Service Issues

If the ssh-agent service won't start:

powershell
# Check for errors in Event Viewer
Get-EventLog -LogName System -Source Service* -Newest 20 |
  Where-Object { $_.Message -like "*ssh*" }

# Repair OpenSSH installation
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

# Restart the computer after reinstalling

### Using SSH Config File with Windows OpenSSH

Create or edit %USERPROFILE%\.ssh\config:

bash
Host github.com
    HostName github.com
    User git
    IdentityFile C:/Users/YourName/.ssh/id_ed25519
    IdentitiesOnly yes

Host gitlab.com
    HostName gitlab.com
    User git
    IdentityFile C:/Users/YourName/.ssh/gitlab_key
    IdentitiesOnly yes

Important: Use forward slashes in paths, even on Windows.

### Corporate/Enterprise Environments

Group Policy may restrict OpenSSH:

powershell
# Check if OpenSSH is blocked by policy
Get-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OpenSSH" -ErrorAction SilentlyContinue

# Check Windows Defender Firewall
Get-NetFirewallRule -DisplayName "*SSH*" | Select-Object DisplayName, Enabled, Action

If blocked, use Git's bundled SSH or contact your IT department.

### WSL (Windows Subsystem for Linux) Considerations

If using WSL alongside Windows:

bash
# In WSL, use Linux SSH, not Windows
which ssh
# Should return: /usr/bin/ssh

# Don't mix Windows and WSL SSH configurations
# Keep separate keys or use ssh-agent forwarding

### Debugging with Verbose Output

For detailed connection information:

powershell
# Maximum verbosity
ssh -vvv git@github.com

# Key things to look for:
# - "Trying private key: ..." - shows which keys are being tried
# - "Authentications that can continue: publickey" - server expects key auth
# - "Authentication succeeded" - successful connection

### Resetting to Clean State

If configuration is too tangled:

powershell
# Remove Git SSH settings
git config --global --unset core.sshCommand
git config --global --unset-all core.sshCommand

# Clear environment variables
[Environment]::SetEnvironmentVariable("GIT_SSH", $null, "User")
[Environment]::SetEnvironmentVariable("GIT_SSH_COMMAND", $null, "User")

# Restart terminal and test
git clone git@github.com:octocat/Hello-World.git

Frequently asked questions

What does "fatal: Could not read from remote repository. Windows OpenSSH not prop" mean?
This error indicates that Git is attempting to use Windows OpenSSH for SSH connections to remote repositories, but the OpenSSH installation is not properly configured or is missing required components. Windows 10 and later include OpenSSH as an optional feature, but Git for Windows also bundles its own SSH client. When these two SSH implementations conflict or when Windows OpenSSH is partially installed, Git cannot establish SSH connections to remote hosts like GitHub, GitLab, or Bitbucket.
How do I fix "fatal: Could not read from remote repository. Windows OpenSSH not prop"?
This error occurs when Git on Windows cannot communicate with remote repositories because Windows OpenSSH is misconfigured or conflicts with Git's bundled SSH client. The fix involves configuring Git to use the correct SSH executable or properly setting up Windows OpenSSH.
What causes "fatal: Could not read from remote repository. Windows OpenSSH not prop"?
Git is configured to use Windows OpenSSH, but the OpenSSH client is not installed or enabled Windows OpenSSH ssh-agent service is not running PATH environment variable has conflicting SSH executables
Is the "fatal: Could not read from remote repository. Windows OpenSSH not prop" error serious?
It is a medium-severity error — more of a blocker than a risk. The steps above resolve it.

Official resources & further reading