Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Security and hardening

git clone over HTTPS fails with error:0A000152 unsafe legacy renegotiation

Your error

fatal: unable to access 'https://git.example.com/team/app.git/': OpenSSL/3.0.13: error:0A000152:SSL routines::unsafe legacy renegotiation disabled1 more line it can show

Fix it fast

Most common cause, 1 of 3

The Git server or its load balancer has no RFC 5746 support

Ask the owner of that endpoint to update the TLS software or firmware, or to put a current reverse proxy in front of it.

Fix
# after the server side is updated, from any client:
openssl s_client -connect git.example.com:443 -servername git.example.com </dev/null 2>&1 | grep -i "secure renegotiation"
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

error:0A000152:SSL routines::unsafe legacy renegotiation disabled means Git's OpenSSL 3.0 or newer refused a TLS peer without RFC 5746 secure renegotiation, which OpenSSL 1.1.1 still allowed by default. The peer is an outdated Git server, load balancer or TLS-inspecting proxy. Update that peer; until then, allow UnsafeLegacyServerConnect through OPENSSL_CONF for the one git command only.

  • Applies to Git 2.56 with libcurl on OpenSSL, OpenSSL 3.0 (Ubuntu 24.04), 3.5 LTS, 3.6, 4.0 and 4.1
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Connect to the Git host with openssl s_client twice: once as is, once with the legacy flag. Failing the first time and printing Secure Renegotiation IS NOT supported the second time proves the peer lacks RFC 5746. The issuer line then says who that peer is: your Git host's usual certificate authority (cause 1) or your company's inspection proxy (cause 2). Add -proxy proxy.example.com:8080 if you only reach the internet through a proxy.

Run this first
openssl s_client -connect git.example.com:443 -servername git.example.com </dev/null 2>&1 | grep -iE "0A000152|renegotiation"
openssl s_client -connect git.example.com:443 -servername git.example.com -legacy_server_connect </dev/null 2>&1 | grep -iE "renegotiation|^issuer="

Then find the line you see in this list and open its fix:

  1. 1The Git server or its load balancer has no RFC 5746 supportOnly this one host fails, other HTTPS remotes such as github.com clone fine, and the issuer is the host's normal public or internal CA
  2. 2A TLS-inspecting proxy on your network is the outdated peerEvery HTTPS host fails the same way from the office network, github.com included, and the issuer line names your company or a security product
  3. 3This machine now runs OpenSSL 3 or later and the peer cannot be fixed yetThe same remote still works from an older build or OS that uses OpenSSL 1.1.1, and the git error names OpenSSL/3 or OpenSSL/4

What does the error look like?

  • fatal: unable to access 'https://git.example.com/team/app.git/': OpenSSL/3.0.13: error:0A000152:SSL routines::unsafe legacy renegotiation disabled
  • error:0A000152:SSL routines::unsafe legacy renegotiation disabled

Cause 1 of 3

The Git server or its load balancer has no RFC 5746 support

You seeOnly this one host fails, other HTTPS remotes such as github.com clone fine, and the issuer is the host's normal public or internal CA

Check

Git stops with unsafe legacy renegotiation disabled because the machine that ends the TLS session for this host never added RFC 5746. OpenSSL's manual calls such a peer unpatched and states that, with neither legacy option set, initial connections to it fail. Old appliances, firmware and self-hosted Git behind an ageing TLS front end are typical.

Check
openssl s_client -connect git.example.com:443 -servername git.example.com -legacy_server_connect </dev/null 2>&1 | grep -i "secure renegotiation"

Fix

Ask the owner of that endpoint to update the TLS software or firmware, or to put a current reverse proxy in front of it. That is the only change without a security cost: accepting unpatched servers leaves clients open to the CVE-2009-3555 prefix attack.

Fix
# after the server side is updated, from any client:
openssl s_client -connect git.example.com:443 -servername git.example.com </dev/null 2>&1 | grep -i "secure renegotiation"

Verify

s_client connects without the flag, and git ls-remote lists branches with no extra settings.

Verify
git ls-remote https://git.example.com/team/app.git | head -n 3

Confirmed by docs.openssl.org

Did this fix it?

Cause 2 of 3

A TLS-inspecting proxy on your network is the outdated peer

You seeEvery HTTPS host fails the same way from the office network, github.com included, and the issuer line names your company or a security product

Check

An inspection proxy ends TLS itself and opens a second session to the real server, so OpenSSL judges the proxy, not the Git host. When the proxy's TLS stack predates secure renegotiation, git, curl and every other OpenSSL 3 client fail for all hosts at once. Comparing the issuer on the office network with the one from another network shows who answers.

Check
openssl s_client -connect github.com:443 -servername github.com -legacy_server_connect </dev/null 2>&1 | grep -E "^issuer="

Fix

Ask the network team to update the proxy, or to exclude your Git hosts from inspection so the session reaches the real server. A per-command stopgap is in cause 3 if work cannot wait.

Fix
# once the proxy is updated or the host is excluded:
openssl s_client -connect github.com:443 -servername github.com </dev/null 2>&1 | grep -E "^issuer=|0A000152"

Verify

The issuer is the Git host's real certificate authority, or the proxy now connects without the legacy flag, and git fetch works.

Verify
git fetch --dry-run

Confirmed by docs.openssl.org

Did this fix it?

Cause 3 of 3

This machine now runs OpenSSL 3 or later and the peer cannot be fixed yet

You seeThe same remote still works from an older build or OS that uses OpenSSL 1.1.1, and the git error names OpenSSL/3 or OpenSSL/4

Check

From OpenSSL 3.0 on, RFC 5746 support is required by default and UnsafeLegacyServerConnect is no longer switched on for you. Upgrading the OS or Git therefore turned an old server that used to work into a hard failure. libcurl, which Git uses for HTTPS, loads the OpenSSL configuration file automatically, so a small config can restore the old behaviour for one process.

Check
curl -V | head -n 1

Fix

Write a separate config file that sets Options = UnsafeLegacyServerConnect in the system_default section, and point OPENSSL_CONF at it only for git commands aimed at that host. Do not put the option in the system-wide openssl.cnf, which would weaken every TLS client on the machine.

Fix
mkdir -p ~/.config
cat > ~/.config/legacy-renegotiation.cnf <<'EOF'
openssl_conf = openssl_init

[openssl_init]
ssl_conf = ssl_sect

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
Options = UnsafeLegacyServerConnect
EOF

OPENSSL_CONF=~/.config/legacy-renegotiation.cnf git clone https://git.example.com/team/app.git

Verify

The clone completes with the variable set and still fails without it, which confirms the stopgap is limited to that command.

Verify
OPENSSL_CONF=~/.config/legacy-renegotiation.cnf git ls-remote https://git.example.com/team/app.git | head -n 3

Confirmed by docs.openssl.org

Did this fix it?

How do I stop it coming back?

  • Add an s_client check without the legacy flag to monitoring for each internal Git host, so a TLS front end without RFC 5746 support is known before anyone upgrades a client.
  • Keep the legacy config in a wrapper script used only for the affected remote, and delete it the day the server is fixed.
  • Before moving build agents to a new OS image, run git ls-remote against every internal remote from that image.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.