Backport patch from https://github.com/jbox-web/redmine_git_hosting/pull/266