Lesstep
Forgejo · Gitea · self-hosted · git over HTTPS · Checked November 22, 2026

Git "self-signed certificate" on a self-hosted Forgejo or Gitea

Git refuses the connection because the HTTPS certificate of your Forgejo or Gitea server is not signed by a certificate authority that Git trusts. Nothing is wrong with the repository or the token. Give Git the certificate of your authority (or the self-signed certificate itself) in http.sslCAInfo, and scope the setting to your server's address so that every other host is still checked as before.

What Git prints

The wording depends on the Git build and its curl. Atlassian's knowledge base page shows the older one:

SSL certificate problem: self-signed certificate in certificate chain

A clone with Git 2.53.0 for Windows from two public test servers with certificates of this kind (not Forgejo servers, November 22, 2026) shows the following. With the OpenSSL backend (-c http.sslBackend=openssl) Git printed the OpenSSL result and its code:

fatal: unable to access 'https://HOST/OWNER/REPO.git/': SSL certificate OpenSSL verify result: self-signed certificate (18)
fatal: unable to access 'https://HOST/OWNER/REPO.git/': SSL certificate OpenSSL verify result: self-signed certificate in certificate chain (19)

The first is a certificate that signed itself (18). The second is a chain that ends at a root the client does not know (19), which is what a private CA gives. With the default Windows backend, schannel, the same situation printed a different text:

fatal: unable to access 'https://HOST/OWNER/REPO.git/': schannel: SEC_E_UNTRUSTED_ROOT (0x80090325)

curl, which Git uses underneath, says in its certificate page that with a self-signed certificate and no matching CA store, the certificate check fails and reports an error, and that its option for a CA file is --cacert.

For reviewing pull requests from the IDE: Pull Request Inbox for Forgejo and Gitea, a plugin for JetBrains IDEs, keeps one token for Codeberg and one for your own server, each sent only to its own server, and on a 401 says that the server rejected it and shows the server's message.

Trust the certificate for this server only

  1. Get the CA certificate (or the self-signed server certificate) as a PEM file from whoever runs the server, for example /path/to/ca.pem.
  2. Tell Git to use it for your server's address only. The Git manual for http.<url>.* says that any http.* option can be applied to some URLs, matched by scheme, host name, port and path:
    git config --global http.https://git.example.com/.sslCAInfo /path/to/ca.pem
    The scheme and host must match the URL you clone from; a port is part of the match (https://git.example.com:3000/). With a verbose run (GIT_CURL_VERBOSE=1) Git prints a CAfile: line with the path it used.
  3. Clone or fetch again.

Atlassian's page gives the same fix with --global http.sslCAInfo, which replaces the trusted list for every host. The Git manual says http.sslCAInfo is the file with the certificates to verify the peer with, and that http.sslVerify defaults to true. None of the steps here turn verification off.

On Windows with the default backend, the same page says that if the certificate is in the Trusted Root Certification Authorities store, git config --global http.sslBackend schannel makes Git use the Windows store, and that this does not disable SSL validation.

Check the server from the command line

Use curl with the same file and your own server's address. Without a token the answer is 401, but it arrives over a trusted connection, so the certificate part is settled:

curl --cacert /path/to/ca.pem -i "https://git.example.com/api/v1/user"

The 401 "token is required" answer means TLS worked. Forgejo's reverse proxy page also says to change ROOT_URL to the HTTPS address so that the links the server generates use HTTPS, after you move to HTTPS.

Forgejo and Gitea pull requests in IntelliJ IDEA

Pull Request Inbox for Forgejo and Gitea, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, keeps one token for Codeberg and one for your own server, each in the IDE's password safe and sent only to its own server. Without a token it reads public repositories; for a private one it says that it needs an access token. When the server refuses a token with 401, the plugin says that the server rejected it (expired or deleted, or from another server), shows the server's message, and offers to open its settings, which link to your server's token page. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).

Get it on JetBrains Marketplace

Forgejo, Gitea and Codeberg are names of their respective owners; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by the Forgejo project, Codeberg e.V., the Gitea project or JetBrains.

More: Git over HTTPS "fatal: Authentication failed" with 2FA · Forgejo and Codeberg SSH "Permission denied (publickey)" · 401 "token is required" and the unknown-token messages · "token does not have at least one of required scope(s)" · 404 "The target couldn't be found." and "not found" · Forgejo and Gitea pull request not created (409, 422, 403) · Forgejo and Gitea pull request plugins for IntelliJ IDEA, compared · 日本語