跳转到内容
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
这是 1.25.5 的文档,已不是最新发布版本。查看最新发布版本

Multi-factor Authentication (MFA)

当前中文文档翻译不是最新版,访问英文版本查看最新内容,或帮助我们翻译

Multi-factor Authentication (also referred to as MFA or 2FA) enhances security by requiring a time-sensitive set of credentials in addition to a password. If a password were later to be compromised, logging into Gitea will not be possible without the additional credentials and the account would remain secure. Gitea supports both TOTP (Time-based One-Time Password) tokens and FIDO-based hardware keys using the Webauthn API.

MFA can be configured within the “Security” tab of the user settings page.

Enabling MFA on a user does affect how the Git HTTP protocol can be used with the Git CLI. This interface does not support MFA, and trying to use a password normally will no longer be possible whilst MFA is enabled. If SSH is not an option for Git operations, an access token can be generated within the “Applications” tab of the user settings page. This access token can be used as if it were a password in order to allow the Git CLI to function over HTTP.

The Gitea API supports providing the relevant TOTP password in the X-Gitea-OTP header, as described in API Usage. This should be used instead of an access token where possible.