2019-09-04 21:01:54 +05:30
---
2020-10-24 23:57:45 +05:30
stage: Create
group: Source Code
2021-02-22 17:27:13 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments"
2019-09-04 21:01:54 +05:30
type: reference
---
2021-03-11 19:13:27 +05:30
# Account and limit settings **(FREE SELF)**
2019-07-31 22:56:46 +05:30
2021-03-08 18:12:59 +05:30
## Default projects limit
2021-09-04 01:27:46 +05:30
You can change the default maximum number of projects that users can create in their personal namespace:
2021-03-08 18:12:59 +05:30
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** , then expand **Account and limit** .
2021-09-04 01:27:46 +05:30
1. Increase or decrease that **Default projects limit** value.
If you set **Default projects limit** to 0, users are not allowed to create projects
in their users personal namespace. However, projects can still be created in a group.
2021-03-08 18:12:59 +05:30
2019-10-12 21:52:04 +05:30
## Max attachment size
2021-09-04 01:27:46 +05:30
You can change the maximum file size for attachments in comments and replies in GitLab:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** , then expand **Account and limit** .
2021-09-04 01:27:46 +05:30
1. Increase or decrease by changing the value in **Maximum attachment size (MB)** .
2019-10-12 21:52:04 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-03-11 19:13:27 +05:30
If you choose a size larger than the configured value for the web server,
you may receive errors. See the [troubleshooting section ](#troubleshooting ) for more
2019-10-12 21:52:04 +05:30
details.
2021-01-29 00:20:46 +05:30
## Max push size
2021-09-04 01:27:46 +05:30
You can change the maximum push size for your repository:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** , then expand **Account and limit** .
2021-09-04 01:27:46 +05:30
1. Increase or decrease by changing the value in **Maximum push size (MB)** .
NOTE:
When you [add files to a repository ](../../project/repository/web_editor.md#create-a-file )
through the web UI, the maximum **attachment** size is the limiting factor,
because the [web server ](../../../development/architecture.md#components )
must receive the file before GitLab can generate the commit.
Use [Git LFS ](../../../topics/git/lfs/index.md ) to add large files to a repository.
2021-01-29 00:20:46 +05:30
2020-06-23 00:09:42 +05:30
## Max import size
2021-09-04 01:27:46 +05:30
You can change the maximum file size for imports in GitLab:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** , then expand **Account and limit** .
2021-09-04 01:27:46 +05:30
1. Increase or decrease by changing the value in **Maximum import size (MB)** .
2020-06-23 00:09:42 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-03-11 19:13:27 +05:30
If you choose a size larger than the configured value for the web server,
you may receive errors. See the [troubleshooting section ](#troubleshooting ) for more
2020-06-23 00:09:42 +05:30
details.
2021-02-22 17:27:13 +05:30
## Personal Access Token prefix
2021-12-11 22:18:48 +05:30
> [Changed](https://gitlab.com/gitlab-org/gitlab/-/issues/342327) in GitLab 14.5. Default prefix added.
2021-02-22 17:27:13 +05:30
You can set a global prefix for all generated Personal Access Tokens.
A prefix can help you identify PATs visually, as well as with automation tools.
2021-12-11 22:18:48 +05:30
NOTE:
For GitLab.com and self-managed instances, the default prefix is `glpat-` .
2021-06-08 01:23:25 +05:30
### Set a prefix
2021-02-22 17:27:13 +05:30
Only a GitLab administrator can set the prefix, which is a global setting applied
to any PAT generated in the system by any user:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** .
2021-02-22 17:27:13 +05:30
1. Expand the **Account and limit** section.
1. Fill in the **Personal Access Token prefix** field.
1. Click **Save changes** .
It is also possible to configure the prefix via the [settings API ](../../../api/settings.md )
using the `personal_access_token_prefix` field.
2021-03-11 19:13:27 +05:30
## Repository size limit **(PREMIUM SELF)**
2019-07-31 22:56:46 +05:30
2021-03-11 19:13:27 +05:30
Repositories in your GitLab instance can grow quickly, especially if you are
2019-09-04 21:01:54 +05:30
using LFS. Their size can grow exponentially, rapidly consuming available storage.
2021-03-11 19:13:27 +05:30
To prevent this from happening, you can set a hard limit for your repositories' size.
2019-09-04 21:01:54 +05:30
This limit can be set globally, per group, or per project, with per project limits
taking the highest priority.
2019-07-31 22:56:46 +05:30
2019-09-04 21:01:54 +05:30
There are numerous use cases where you might set up a limit for repository size.
2019-07-31 22:56:46 +05:30
For instance, consider the following workflow:
2019-09-04 21:01:54 +05:30
1. Your team develops apps which require large files to be stored in
2019-07-31 22:56:46 +05:30
the application repository.
2020-05-24 23:13:21 +05:30
1. Although you have enabled [Git LFS ](../../../topics/git/lfs/index.md#git-large-file-storage-lfs )
2019-07-31 22:56:46 +05:30
to your project, your storage has grown significantly.
2019-09-04 21:01:54 +05:30
1. Before you exceed available storage, you set up a limit of 10 GB
2019-07-31 22:56:46 +05:30
per repository.
### How it works
Only a GitLab administrator can set those limits. Setting the limit to `0` means
there are no restrictions.
2021-03-11 19:13:27 +05:30
These settings can be found in:
2019-07-31 22:56:46 +05:30
2019-12-04 20:38:33 +05:30
- Each project's settings:
1. From the Project's homepage, navigate to **Settings > General** .
1. Fill in the **Repository size limit (MB)** field in the **Naming, topics, avatar** section.
1. Click **Save changes** .
- Each group's settings:
1. From the Group's homepage, navigate to **Settings > General** .
1. Fill in the **Repository size limit (MB)** field in the **Naming, visibility** section.
1. Click **Save changes** .
2021-02-22 17:27:13 +05:30
- GitLab global settings:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** .
2019-12-04 20:38:33 +05:30
1. Expand the **Account and limit** section.
1. Fill in the **Size limit per repository (MB)** field.
1. Click **Save changes** .
2019-07-31 22:56:46 +05:30
2021-03-11 19:13:27 +05:30
The first push of a new project, including LFS objects, is checked for size.
If the sum of their sizes exceeds the maximum allowed repository size, the push
is rejected.
2019-09-04 21:01:54 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-01-29 00:20:46 +05:30
The repository size limit includes repository files and LFS, but does not include artifacts, uploads,
2021-12-11 22:18:48 +05:30
wiki, packages, or snippets. The repository size limit applies to both private and public projects.
2019-09-30 21:07:59 +05:30
2019-09-04 21:01:54 +05:30
For details on manually purging files, see [reducing the repository size using Git ](../../project/repository/reducing_the_repo_size_using_git.md ).
2021-02-22 17:27:13 +05:30
NOTE:
2021-01-29 00:20:46 +05:30
For GitLab.com repository size limits, see [accounts and limit settings ](../../gitlab_com/index.md#account-and-limit-settings ).
2019-07-31 22:56:46 +05:30
2019-10-12 21:52:04 +05:30
## Troubleshooting
### 413 Request Entity Too Large
2021-03-11 19:13:27 +05:30
When attaching a file to a comment or reply in GitLab displays a `413 Request Entity Too Large`
error, the [max attachment size ](#max-attachment-size )
is probably larger than the web server's allowed value.
2019-07-31 22:56:46 +05:30
2021-03-11 19:13:27 +05:30
To increase the max attachment size to 200 MB in a
[Omnibus GitLab ](https://docs.gitlab.com/omnibus/ ) install, you may need to
2019-10-12 21:52:04 +05:30
add the line below to `/etc/gitlab/gitlab.rb` before increasing the max attachment size:
2019-07-31 22:56:46 +05:30
2020-03-13 15:44:24 +05:30
```ruby
2019-10-12 21:52:04 +05:30
nginx['client_max_body_size'] = "200m"
```
2020-01-01 13:55:28 +05:30
2021-12-11 22:18:48 +05:30
## Customize session duration for Git Operations when 2FA is enabled **(PREMIUM SELF)**
2021-03-11 19:13:27 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/296669) in GitLab 13.9.
> - It's deployed behind a feature flag, disabled by default.
> - It's disabled on GitLab.com.
> - It's not recommended for production use.
2021-11-11 11:23:49 +05:30
> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](../../../security/two_factor_authentication.md#enable-or-disable-2fa-for-git-operations).
2021-10-27 15:23:28 +05:30
NOTE:
This feature is under development and not ready for production use. It is deployed
behind a feature flag that is **disabled by default** . To use it in GitLab
2021-11-11 11:23:49 +05:30
self-managed instances, ask a GitLab administrator to [enable it ](../../../security/two_factor_authentication.md#enable-or-disable-2fa-for-git-operations ).
2020-01-01 13:55:28 +05:30
2021-03-11 19:13:27 +05:30
GitLab administrators can choose to customize the session duration (in minutes) for Git operations when 2FA is enabled. The default is 15 and this can be set to a value between 1 and 10080.
To set a limit on how long these sessions are valid:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** .
2021-03-11 19:13:27 +05:30
1. Expand the **Account and limit** section.
1. Fill in the **Session duration for Git operations when 2FA is enabled (minutes)** field.
1. Click **Save changes** .
2021-06-08 01:23:25 +05:30
## Limit the lifetime of personal access tokens **(ULTIMATE SELF)**
2021-03-11 19:13:27 +05:30
2021-12-11 22:18:48 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/3649) in GitLab 12.6.
2020-01-01 13:55:28 +05:30
2021-04-17 20:07:23 +05:30
Users can optionally specify a lifetime for
2020-01-01 13:55:28 +05:30
[personal access tokens ](../../profile/personal_access_tokens.md ).
2021-04-17 20:07:23 +05:30
This lifetime is not a requirement, and can be set to any arbitrary number of days.
2020-01-01 13:55:28 +05:30
2021-03-11 19:13:27 +05:30
Personal access tokens are the only tokens needed for programmatic access to GitLab.
However, organizations with security requirements may want to enforce more protection by
requiring the regular rotation of these tokens.
2020-01-01 13:55:28 +05:30
2021-06-08 01:23:25 +05:30
### Set a lifetime
2020-01-01 13:55:28 +05:30
2021-04-17 20:07:23 +05:30
Only a GitLab administrator can set a lifetime. Leaving it empty means
2020-01-01 13:55:28 +05:30
there are no restrictions.
2021-04-17 20:07:23 +05:30
To set a lifetime on how long personal access tokens are valid:
2020-01-01 13:55:28 +05:30
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** .
2020-01-01 13:55:28 +05:30
1. Expand the **Account and limit** section.
2020-03-13 15:44:24 +05:30
1. Fill in the **Maximum allowable lifetime for personal access tokens (days)** field.
2020-01-01 13:55:28 +05:30
1. Click **Save changes** .
2021-03-11 19:13:27 +05:30
Once a lifetime for personal access tokens is set, GitLab:
2020-01-01 13:55:28 +05:30
2021-03-11 19:13:27 +05:30
- Applies the lifetime for new personal access tokens, and require users to set an expiration date
2020-01-01 13:55:28 +05:30
and a date no later than the allowed lifetime.
- After three hours, revoke old tokens with no expiration date or with a lifetime longer than the
allowed lifetime. Three hours is given to allow administrators to change the allowed lifetime,
or remove it, before revocation takes place.
2020-03-13 15:44:24 +05:30
2021-09-30 23:02:18 +05:30
## Allow expired SSH keys to be used **(ULTIMATE SELF)**
2020-07-28 23:09:34 +05:30
2021-09-04 01:27:46 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/250480) in GitLab 13.9.
> - [Enabled by default](https://gitlab.com/gitlab-org/gitlab/-/issues/320970) in GitLab 14.0.
2020-07-28 23:09:34 +05:30
2021-09-04 01:27:46 +05:30
By default, expired SSH keys **are not usable** .
2021-06-08 01:23:25 +05:30
2021-09-04 01:27:46 +05:30
To allow the use of expired SSH keys:
2021-06-08 01:23:25 +05:30
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** .
2020-07-28 23:09:34 +05:30
1. Expand the **Account and limit** section.
2021-09-04 01:27:46 +05:30
1. Uncheck the **Enforce SSH key expiration** checkbox.
2021-04-17 20:07:23 +05:30
2021-09-04 01:27:46 +05:30
Disabling SSH key expiration immediately enables all expired SSH keys.
2021-04-17 20:07:23 +05:30
2021-09-30 23:02:18 +05:30
## Allow expired Personal Access Tokens to be used **(ULTIMATE SELF)**
2020-07-28 23:09:34 +05:30
2021-12-11 22:18:48 +05:30
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/214723) in GitLab 13.1.
2021-03-11 19:13:27 +05:30
> - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/296881) in GitLab 13.9.
2020-07-28 23:09:34 +05:30
2021-09-30 23:02:18 +05:30
By default, expired personal access tokens (PATs) **are not usable** .
2020-07-28 23:09:34 +05:30
2021-09-30 23:02:18 +05:30
To allow the use of expired PATs:
2020-07-28 23:09:34 +05:30
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** .
2021-03-11 19:13:27 +05:30
1. Expand the **Account and limit** section.
1. Uncheck the **Enforce personal access token expiration** checkbox.
2020-07-28 23:09:34 +05:30
2021-06-08 01:23:25 +05:30
## Disable user profile name changes **(PREMIUM SELF)**
2020-03-13 15:44:24 +05:30
2020-06-23 00:09:42 +05:30
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/24605) in GitLab 12.7.
2020-03-13 15:44:24 +05:30
To maintain integrity of user details in [Audit Events ](../../../administration/audit_events.md ), GitLab administrators can choose to disable a user's ability to change their profile name.
To do this:
2021-11-11 11:23:49 +05:30
1. On the top bar, select **Menu > Admin** .
1. On the left sidebar, select **Settings > General** , then expand **Account and limit** .
2021-09-04 01:27:46 +05:30
1. Select the **Prevent users from changing their profile name** checkbox.
2020-03-13 15:44:24 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2021-03-11 19:13:27 +05:30
When this ability is disabled, GitLab administrators can still use the
[Admin UI ](../index.md#administering-users ) or the
[API ](../../../api/users.md#user-modification ) to update usernames.