VPS Tutorials
Fix GitHub Clone Timeouts on a VPS: SSH 443, Proxies and HTTPS (2026)
Inspect Git's actual protocol and configuration, compare small requests, repair ports or proxies, check repository access and verify the deployment user.

If git clone, git fetch or a deployment script times out connecting to GitHub, perhaps stopping at Cloning into..., while the repository opens in a browser, first identify HTTPS versus SSH, and direct access versus a proxy. A working webpage does not prove outbound SSH port 22 works or that the deployment account can access the repository.
This guide covers GitHub.com: inspect the actual connection, test small requests, diagnose ports/proxies, check authentication and verify deployment. GitHub Enterprise Server and enterprise data-residency domains require their own documentation; the public SSH-on-443 endpoint below is not interchangeable with those services.
| Error or symptom | Start with |
|---|---|
Could not resolve host: github.com | VPS DNS and proxy-host resolution |
connect to host github.com port 22: Connection timed out | Outbound SSH port 22 and network path |
Failed connection to 127.0.0.1:7890 or an old proxy | Actual availability of the configured/environment proxy |
SSL certificate problem | Clock, trusted CAs, TLS inspection and Git trust settings |
Permission denied (publickey) | SSH reached authentication; inspect keys/account |
Repository not found, 401/403 | Repository URL, permission, credentials and organization policy |
RPC failed, HTTP/2 stream errors, early EOF | Interrupted transfer: protocol, proxy, logs and repository size |
GitHub lists firewalls, proxies and network rules among common causes; see connection troubleshooting. A failed clone alone does not justify replacing the repository with a mirror or generating new keys.
Use the same user, terminal or service environment that fails:
git --version
git remote -v
git config --show-origin --get-regexp '^url\..*\.insteadof$'
git config --show-origin --get-urlmatch http.proxy https://github.com/
git config --show-origin --get-urlmatch http.sslVerify https://github.com/
env | grep -iE '^(http_proxy|https_proxy|all_proxy|no_proxy)='
Before a repository exists locally, skip git remote -v and inspect the intended clone URL. Empty configuration output may simply mean an option is unset.
https://github.com/OWNER/REPO.git uses HTTPS; [email protected]:OWNER/REPO.git normally uses SSH. url.*.insteadOf can rewrite a URL, so an apparent HTTPS command may use SSH. --show-origin identifies the configuration's source file.
Check whether the proxy belongs to this machine. 127.0.0.1:7890 on your laptop points to your laptop; on the VPS it points to the VPS. It works only if that machine runs the proxy. An HTTP proxy setting also does not automatically proxy OpenSSH.
Proxy/remote URLs and environment output can contain credentials. Inspect locally and redact usernames, passwords and tokens before sharing; keep raw output out of public tickets.
Test DNS/HTTPS, then query references from a public repository:
getent ahosts github.com
curl -I --connect-timeout 5 --max-time 15 https://github.com/
GIT_TERMINAL_PROMPT=0 git ls-remote https://github.com/vercel/next.js.git HEAD
git ls-remote does not download the whole repository. The public example needs no private token and provides a connectivity comparison. Recheck URL rewrites to know the protocol actually used.
If the webpage works but Git fails, investigate Git-specific proxy/configuration/TLS. If public access works but the private target fails, check URL and permissions first. A small request does not cover large packs, LFS or submodules.
Test SSH port 22:
ssh -vT -o ConnectTimeout=10 [email protected]
On first connection, compare the displayed fingerprint with GitHub's official fingerprints before accepting. Do not hide identity problems using StrictHostKeyChecking=no.
Successful GitHub SSH authentication says shell access is unavailable and may still return exit 1. Read the account in the authentication message and verify repository access; a nonzero SSH-test exit does not automatically mean a blocked port. See GitHub's SSH test.
When HTTPS works but SSH 22 times out, check outbound firewall/security groups, provider networking and existing proxies. GitHub.com offers this official alternative:
ssh -T -p 443 -o ConnectTimeout=10 [email protected]
The hostname is ssh.github.com. This is SSH on port 443, not HTTPS; equipment allowing only actual HTTPS may still block it. Verify the official fingerprint on first connection.
After authentication succeeds, test an explicit URL without changing other SSH settings:
git clone ssh://[email protected]:443/OWNER/REPO.git
Replace OWNER/REPO with the target repository. GitHub's SSH-over-443 guidance also excludes directly applying this public endpoint to Enterprise Server and Enterprise Cloud data-residency scenarios.
To route existing github.com SSH URLs through 443, back up ~/.ssh/config, inspect current GitHub Host blocks and merge:
Host github.com
HostName ssh.github.com
Port 443
User git
Retain IdentityFile, account aliases and required settings. Do not overwrite the entire file or add conflicting duplicate Host blocks. Multiple GitHub accounts need their existing key-selection rules.
Inspect effective settings and test:
ssh -G [email protected] | grep -Ei '^(hostname|port|user|identityfile|proxycommand|proxyjump) '
ssh -T [email protected]
Undo only these fields or restore the backup if no longer needed. GitHub outbound access does not require changing the VPS's own SSH server.
If logs show an old address, wrong port or nonexistent local proxy, establish whether direct access is permitted. Where it is, test without persisting changes:
env -u http_proxy -u https_proxy -u all_proxy \
-u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY \
git -c http.proxy= -c http.https://github.com/.proxy= \
ls-remote https://github.com/vercel/next.js.git HEAD
This removes common proxy environment variables and clears ordinary/GitHub URL-level HTTP proxy settings for one command. More specific URL/remote settings and rewrites can still apply; it does not ignore every Git setting.
If direct access succeeds, use --show-origin to locate the broken setting in shell files, service environments, repository or global configuration. Record its original value and change only the confirmed issue. Keep ~/.gitconfig and unrelated working proxies intact.
If controlled proxy access is required, repair its listener, address, authentication and trusted certificates. A failed direct test does not establish that the proxy is correct. See git-config proxy rules.
For certificate errors, check time, distribution CA packages and authorized TLS inspection. Obtain an inspection CA from a trusted administrative source and configure system/Git trust properly. Keep HTTPS verification enabled: http.sslVerify=false and GIT_SSL_NO_VERIFY bypass identity checks. A random GitHub IP in hosts can introduce stale addresses, wrong paths and identity risks.
If logs specifically suggest HTTP/2 or intermediary compatibility, compare one HTTP/1.1 request:
git -c http.version=HTTP/1.1 \
ls-remote https://github.com/vercel/next.js.git HEAD
If it helps, inspect Git, libcurl and proxy versions and the actual target transfer. It fixes neither DNS nor SSH authentication/permissions and does not guarantee recovery from every early EOF. On RPC failed, changing protocol, buffers and TLS verification simultaneously obscures the cause. A huge http.postBuffer is not a universal clone fix; see git-config option semantics.
If IPv4 works while default access fails, compare paths:
curl -4 -I --connect-timeout 5 --max-time 15 https://github.com/
ssh -4 -T -o ConnectTimeout=10 [email protected]
Investigate IPv6 addresses, routing and DNS when results differ. One failed snapshot is not a reason to disable all IPv6. Check SSH and HTTPS paths separately.
Permission denied (publickey) indicates SSH authentication. Inspect the deployment user's real public key, GitHub account/deploy key and key selection shown by ssh -vT. Root, deployment and CI users may have different SSH configuration.
GitHub HTTPS Git operations do not accept an account password for private-repository authentication; use an appropriate token or supported credential tool. Repository not found can mean an incorrect URL or insufficient access. Organization SSO, token scope and expiry matter too. See clone error troubleshooting.
Keep tokens out of URLs, scripts, history and logs. For single-repository deployments, consider restricted credentials. Repair authentication and repository permission before retesting the target; switching ports repeatedly will not grant access.
Identify whether Git packs, LFS, submodules or subsequent dependency installation is stalled. LFS/submodules may contact other hosts, outside the reference query's coverage.
If recent history is sufficient, consider a shallow clone. For objects fetched on demand, consider partial clone:
git clone --depth 1 https://github.com/OWNER/REPO.git
git clone --filter=blob:none https://github.com/OWNER/REPO.git
These are alternatives, not consecutive steps. Shallow history can affect version calculation, merges and CI. Partial clones can fetch objects during checkout and later commands. See git-clone. They reduce appropriate transfers, not blocked ports or authentication failures.
For time-dependent slowness, record time/path/errors and check GitHub Status. Comparisons across times and networks help separate incidents, congestion and local settings instead of assuming rate limiting.
Run read-only git ls-remote against the target repository, then clone to a new directory or perform a controlled fetch to confirm the expected commit. A public test repository does not establish private access. Avoid arbitrary git pull in a production directory with uncommitted work.
If CI or a coding agent still fails, inspect DNS, proxies, keys and configuration under its real user/service/container. An interactive SSH shell can differ from a service's inherited environment. Retain failure/change records and restrict trace logs; inspect and redact before sharing.
- Resolution failures: VPS DNS and systemd-resolved.
- Changed host keys: fingerprints and safe known_hosts repair.
- Different runner environment: self-hosted GitHub Actions and isolation.