Supported SCMs
Git
The most commonly used SCM. Supports local and remote repositories. Configured via the
git binary.Subversion (SVN)
Supports both file:// and http(s):// repository URLs. Requires the
svn binary.Mercurial
Requires the
hg binary. Configure the path in configuration.yml on Windows.Bazaar
Requires the
bzr binary. On Windows, .cmd and .bat wrappers do not work with CRuby — use the full path to the executable.CVS
Legacy SCM support. Requires the
cvs binary.Filesystem
Browse a local filesystem directory as a read-only repository. No binary required.
Enabling SCM types
Only SCM types listed in Administration → Settings → Repositories → Enabled SCM are available when creating a repository in project settings. The default enabled SCMs are:config/settings.yml (default)
SCM binary paths
Redmine calls SCM command-line binaries to fetch commits and display repository content. By default, it assumes each binary is available inPATH. You can override the command path for each SCM in config/configuration.yml:
config/configuration.yml
Repository path validation
You can restrict which repository paths users are allowed to enter by configuring a regular expression per SCM. The expression is anchored (\A...\z) and case-sensitive:
config/configuration.yml
%project% in the pattern to match the project identifier.
You can also set a custom hint message shown on the repository form:
config/configuration.yml
Adding a repository to a project
- Open a project and go to Settings → Repositories.
- Click Add a new repository.
- Select the SCM type from the drop-down (only enabled SCMs appear).
- Enter the repository URL or local path.
- For repositories requiring authentication, enter the credentials. Credentials are stored encrypted in the database when
database_cipher_keyis configured inconfig/configuration.yml. - Click Create.
Fetching commits
Automatic fetch
When Autofetch changesets is enabled (Administration → Settings → Repositories), Redmine fetches new commits from the repository each time a user views the repository browser. This is the default behavior (autofetch_changesets: 1).
Manual fetch
To fetch commits on a schedule without relying on browser visits, call the repository fetch URL with the API key:| Setting | Description |
|---|---|
sys_api_enabled | Enable the /sys/ API endpoint for repository management. |
sys_api_key | Secret key required in the key parameter of sys API calls. |
Webhook-based fetch (Git)
For Git repositories hosted on platforms that support webhooks, configure the platform to call the Redmine fetch URL on push events:Linking commits to issues
Commits that mention an issue number are linked to that issue automatically. The keywords that trigger a reference are set in Administration → Settings → Repositories:| Setting | Default | Description |
|---|---|---|
commit_ref_keywords | refs,references,IssueID | Keywords that create a reference link from the commit to the issue. |
commit_update_keywords | (empty) | Rules that update issue status or other fields when a keyword appears in a commit message. |
commit_cross_project_ref | 0 | Allow commits to reference issues in other projects using the project-identifier#123 format. |
Commit update keywords
Commit update keyword rules map a keyword (e.g.fixes, closes) to an issue status change and optional done ratio update. Example: a commit message of fixes #123 with a rule for fixes can automatically close issue #123.
Rules are configured at Administration → Settings → Repositories → Commit update keywords.
SCM errors log
SCM command errors (stderr output) are written to the Redmine log directory by default. To redirect them to a separate file, setscm_stderr_log_file in config/configuration.yml:
config/configuration.yml
Repository browser
The repository browser allows users to:- Browse the directory tree at any revision.
- View file contents with syntax highlighting (powered by Rouge).
- Compare file revisions side by side.
- View the commit log for any file or directory.
- View diff output for each commit.
| Setting | Default | Description |
|---|---|---|
file_max_size_displayed | 512 (KB) | Maximum file size that the inline file viewer will display. |
diff_max_lines_displayed | 1500 | Maximum number of diff lines shown in the browser. |
