Error 500 on create new repo

Hello there,
on fresh new server installation I get Error 500 page after create new repo when I check Initialize Repository otherwise repo is created but can’t push any data.

Configuration:
Gitea v 1.8.3 (1.9.0rc2 tried too)
Git v2.2.2
OS: Windows 10
Database: MSSQL (SQLite tried too)

Config:

Summary

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = TestServer2
RUN_MODE = prod

[oauth2]
JWT_SECRET = [secret]

[security]
INTERNAL_TOKEN = [token]
INSTALL_LOCK = true
SECRET_KEY = [secret]

[database]
DB_TYPE = sqlite3
HOST = 127.0.0.1:3306
NAME = gitea
USER = gitea
PASSWD =
SSL_MODE = disable
CHARSET = utf8
PATH = C:/test/data/gitea.db

[repository]
ROOT = C:/test/data/repos

[server]
SSH_DOMAIN = localhost
DOMAIN = localhost
HTTP_PORT = 3000
ROOT_URL = http://localhost:3000/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = C:/test/data/lfs
LFS_JWT_SECRET = [secret]
OFFLINE_MODE = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.example.org

[picture]
DISABLE_GRAVATAR = false
ENABLE_FEDERATED_AVATAR = true

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[session]
PROVIDER = file

[log]
MODE = file
LEVEL = trace
ROOT_PATH = C:/test/log

Log:

Summary

2019/07/17 14:17:15 …/xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT id, lower_name, name, full_name, email, keep_email_private, passwd, must_change_password, login_type, login_source, login_name, type, location, website, rands, salt, language, description, created_unix, updated_unix, last_login_unix, last_repo_visibility, max_repo_creation, is_active, is_admin, allow_git_hook, allow_import_local, allow_create_organization, prohibit_login, avatar, avatar_email, use_custom_avatar, num_followers, num_following, num_stars, num_repos, num_teams, num_members, visibility, diff_view_style, theme FROM user WHERE id=? LIMIT 1 []interface {}{1}
2019/07/17 14:17:15 …s/context/context.go:315:func1() [D] Session ID: 710c45021a6c10db
2019/07/17 14:17:15 …s/context/context.go:316:func1() [D] CSRF Token: rmybewd2agCChqY8KL-nj917umI6MTU2MzM2NTEzNDc2ODQ0NjYwMA==
2019/07/17 14:17:15 …/xorm/session_raw.go:87:queryRow() [I] [SQL] SELECT count(*) FROM notification WHERE (user_id = ?) AND (status = ?) []interface {}{1, 0x1}
2019/07/17 14:17:15 …xorm/session_find.go:199:noCacheFind() [I] [SQL] SELECT * FROM user INNER JOIN team_user ON team_user.org_id=user.id INNER JOIN team ON team.id=team_user.team_id WHERE (team_user.uid=?) AND (team.authorize=?) ORDER BY updated_unix DESC, user.name ASC []interface {}{1, 4}
2019/07/17 14:17:15 …xorm/xorm/session.go:845:saveLastSQL() [I] [SQL] BEGIN TRANSACTION
2019/07/17 14:17:15 …/xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT id, owner_id, lower_name, name, description, website, default_branch, num_watches, num_stars, num_forks, num_issues, num_closed_issues, num_pulls, num_closed_pulls, num_milestones, num_closed_milestones, is_private, is_empty, is_archived, is_mirror, is_fork, fork_id, size, is_fsck_enabled, close_issues_via_commit_in_any_branch, topics, avatar, created_unix, updated_unix FROM repository WHERE owner_id=? AND lower_name=? LIMIT 1 []interface {}{1, “test”}
2019/07/17 14:17:15 …rm/session_insert.go:513:innerInsert() [I] [SQL] INSERT INTO repository (owner_id,lower_name,name,description,website,default_branch,num_watches,num_stars,num_forks,num_issues,num_closed_issues,num_pulls,num_closed_pulls,num_milestones,num_closed_milestones,is_private,is_empty,is_archived,is_mirror,is_fork,fork_id,size,is_fsck_enabled,close_issues_via_commit_in_any_branch,topics,avatar,created_unix,updated_unix) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{1, “test”, “test”, “”, “”, “”, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, false, false, false, false, 0, 0, true, false, “null”, “”, 1563365835, 1563365835}
2019/07/17 14:17:15 …rm/session_delete.go:211:Delete() [I] [SQL] DELETE FROM repo_redirect WHERE owner_id=? AND lower_name=? []interface {}{1, “test”}
2019/07/17 14:17:15 …rm/session_insert.go:264:innerInsertMulti() [I] [SQL] INSERT INTO repo_unit (repo_id, type, config, created_unix) VALUES (?, ?, ?, ?),(?, ?, ?, ?),(?, ?, ?, ?),(?, ?, ?, ?),(?, ?, ?, ?) []interface {}{1, 1, interface {}(nil), 1563365835, 1, 2, “{“EnableTimetracker”:true,“AllowOnlyContributorsToTrackTime”:true,“EnableDependencies”:true}”, 1563365835, 1, 3, “{“IgnoreWhitespaceConflicts”:false,“AllowMerge”:true,“AllowRebase”:true,“AllowRebaseMerge”:true,“AllowSquash”:true}”, 1563365835, 1, 4, interface {}(nil), 1563365835, 1, 5, interface {}(nil), 1563365835}
2019/07/17 14:17:15 …rm/session_update.go:375:Update() [I] [SQL] UPDATE user SET lower_name = ?, name = ?, full_name = ?, email = ?, keep_email_private = ?, passwd = ?, must_change_password = ?, login_type = ?, login_source = ?, login_name = ?, type = ?, location = ?, website = ?, rands = ?, salt = ?, language = ?, description = ?, last_login_unix = ?, last_repo_visibility = ?, max_repo_creation = ?, is_active = ?, is_admin = ?, allow_git_hook = ?, allow_import_local = ?, allow_create_organization = ?, prohibit_login = ?, avatar = ?, avatar_email = ?, use_custom_avatar = ?, num_followers = ?, num_following = ?, num_stars = ?, num_repos = ?, num_teams = ?, num_members = ?, visibility = ?, diff_view_style = ?, theme = ?, updated_unix = ? WHERE id=? []interface {}{“lukasm03”, “lukasm03”, “”, "lukas.macas@embraco.com", false, “0af4f44cca646115c9096d744e4f2e433c60aa6921c29d908f800ed18b54b2e679fb3d7a2503c42dfd8eabfcbf3e305bcff2”, false, 0, 0, “”, 0, “”, “”, “w8nGLC4LIl”, “6be8WygioK”, “en-US”, “”, 1563365134, false, -1, true, true, false, false, true, false, “fd0290e9e7ab5bcdb48fa58a11bd764e”, "lukas.macas@embraco.com", false, 0, 0, 0, 1, 0, 0, 0, “”, “gitea”, 1563365835, 1}
2019/07/17 14:17:15 …xorm/session_find.go:199:noCacheFind() [I] [SQL] SELECT id, repo_id, user_id, mode FROM collaboration WHERE repo_id=? []interface {}{1}
2019/07/17 14:17:15 …rm/session_delete.go:211:Delete() [I] [SQL] DELETE FROM access WHERE repo_id=? []interface {}{1}
2019/07/17 14:17:15 …/xorm/session_get.go:99:nocacheGet() [I] [SQL] SELECT id, user_id, repo_id FROM watch WHERE user_id=? AND repo_id=? LIMIT 1 []interface {}{1, 1}
2019/07/17 14:17:15 …rm/session_insert.go:513:innerInsert() [I] [SQL] INSERT INTO watch (user_id,repo_id) VALUES (?, ?) []interface {}{1, 1}
2019/07/17 14:17:15 …/xorm/session_raw.go:226:Exec() [I] [SQL] UPDATE repository SET num_watches = num_watches + 1 WHERE id = ? []interface {}{1}
2019/07/17 14:17:15 …xorm/session_find.go:199:noCacheFind() [I] [SQL] SELECT * FROM watch INNER JOIN user ON user.id = watch.user_id WHERE (watch.repo_id=?) AND (user.is_active=?) AND (user.prohibit_login=?) []interface {}{1, true, false}
2019/07/17 14:17:15 …rm/session_insert.go:513:innerInsert() [I] [SQL] INSERT INTO action (user_id,op_type,act_user_id,repo_id,comment_id,is_deleted,ref_name,is_private,content,created_unix) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) []interface {}{1, 1, 1, 1, 0, false, “”, false, “”, 1563365835}
2019/07/17 14:17:15 models/action.go:323:newRepoAction() [T] action.newRepoAction: lukasm03/test
2019/07/17 14:17:15 …xorm/session_find.go:199:noCacheFind() [I] [SQL] SELECT id, repo_id, org_id, url, signature, http_method, content_type, secret, events, is_ssl, is_active, hook_task_type, meta, last_status, created_unix, updated_unix FROM webhook WHERE (repo_id=? AND org_id=?) []interface {}{0, 0}
2019/07/17 14:17:16 …xorm/xorm/session.go:845:saveLastSQL() [I] [SQL] ROLL BACK
2019/07/17 14:17:16 routers/repo/repo.go:148:handleCreateError() [E] CreatePost: initRepository: initRepoCommit: git push: remote: Wsh
To C:\test\data\repos\lukasm03\test.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ‘C:\test\data\repos\lukasm03\test.git’

2019/07/17 14:17:16 …s/context/context.go:137:HTML() [D] Template: status/500

I’d like to bump that. Same problem… Just installed the latest version (1.9.2) on my server. I use an Apache reverse proxy.

Everything looks just fine, I can administer the database and the site, but when adding a new repo I get a 500 error. The new repo is actually created, both in the $GITEA_WORK_DIR/gitea-repositories/admin and there is a database entry for it. But whenever a link to it is clicked, I get the 500.

This is in my config:

[server]
SSH_DOMAIN       = localhost
DOMAIN           = localhost
HTTP_PORT        = 3000
ROOT_URL         = https://www.example.com/mysites/git

This is the server output I get when I try to make a new repo:

[Macaron] 2019-08-24 22:04:00: Started GET / for 123.123.123.123
[Macaron] 2019-08-24 22:04:00: Completed GET / 200 OK in 18.208662ms
[Macaron] 2019-08-24 22:04:00: Started GET /api/v1/users/admin/heatmap for 123.123.123.123
[Macaron] 2019-08-24 22:04:00: Completed GET /api/v1/users/admin/heatmap 200 OK in 6.26683ms
[Macaron] 2019-08-24 22:04:01: Started GET /api/v1/repos/search?sort=updated&order=desc&uid=1&q=&limit=15&mode= for 123.123.123.123
[Macaron] 2019-08-24 22:04:01: Completed GET /api/v1/repos/search?sort=updated&order=desc&uid=1&q=&limit=15&mode= 200 OK in 13.716375ms
[Macaron] 2019-08-24 22:04:08: Started GET /repo/create for 123.123.123.123
[Macaron] 2019-08-24 22:04:08: Completed GET /repo/create 200 OK in 16.722665ms
[Macaron] 2019-08-24 22:05:11: Started POST /repo/create for 123.123.123.123
[Macaron] 2019-08-24 22:05:11: Completed POST /repo/create 302 Found in 38.394196ms
[Macaron] 2019-08-24 22:05:11: Started GET /admin/myrepo for 123.123.123.123
[Macaron] 2019-08-24 22:05:11: Completed GET /admin/myrepo 500 Internal Server Error in 10.174483ms

I solved my problem… For some reason I had a GIT_DIR environment variable defined, which made the git init command behave unexpectedly. The solution was to unset said variable.