fatal: could not read from remote repository
Git’s fatal: could not read from remote repository error means Git couldn’t connect to the remote server to fetch or push data, usually due to an authentication, network, or URL problem.
What It Means
Git attempts to establish a connection to the remote repository URL configured for your repo. If the connection fails at the transport layer — SSH handshake fails, HTTPS credentials are rejected, DNS lookup fails, or the server is unreachable — Git reports that it couldn’t read from the remote. The error is often accompanied by a more specific message like Permission denied (publickey) or Could not resolve host.
Why It Happens
- SSH key isn’t configured or is incorrect for the remote host.
- Remote URL is wrong (typo in the repo path or hostname).
- Network issues: VPN not connected, corporate firewall blocking ports, or DNS resolution failure.
- Repository doesn’t exist on the server (deleted, renamed, or private and you lack access).
- HTTPS credentials expired or personal access token revoked.
How to Fix It
1. Test SSH authentication (for SSH remotes)
ssh -T git@github.com
ssh -T git@gitlab.comIf you see Permission denied, follow the SSH key setup guide.
2. Verify the remote URL
git remote -vCheck the URL for typos. If it’s wrong, update it:
# SSH format
git remote set-url origin git@github.com:user/repo.git
# HTTPS format
git remote set-url origin https://github.com/user/repo.git3. Switch from SSH to HTTPS (or vice versa)
If SSH is blocked by your firewall, try HTTPS:
git remote set-url origin https://github.com/user/repo.gitOr if HTTPS isn’t working, try SSH:
git remote set-url origin git@github.com:user/repo.git4. Test DNS and network connectivity
ping github.com
nslookup github.comIf ping fails, check your internet connection, VPN, or proxy settings.
5. Use a personal access token (for HTTPS)
GitHub deprecated password authentication over HTTPS. Use a personal access token:
git clone https://github.com/user/repo.git
# Enter username: your-username
# Enter password: your-personal-access-token6. Check repository access
Open the URL in a browser. If you get a 404, the repo may be private (and you’re not a collaborator), renamed, or deleted.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro