Migration from local path fails with "migrate from '' is not allowed: unknown hostname" #6877

Closed
opened 2025-11-02 07:09:44 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @masche842 on GitHub (Feb 16, 2021).

  • Gitea version: 1.13.2
  • Git version: 2.26.2
  • Operating system:
    Ubuntu 16.04.6 LTS,
    Docker image gitea/gitea:1
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
  • Logs:
    [loads of SQL log entries]
    2021/02/16 17:35:06 modules/task/task.go:51:handle() [E] Run task failed: migrate from '' is not allowed: unknown hostname

Description

In recent gitea versions importing from local files fails with the error "modules/task/task.go:51:handle() [E] Run task failed: migrate from '' is not allowed: unknown hostname".
This appears to be an artifact of #13610 which attempts to verify IP address range even for local files.
Consequently setting [migrations]ALLOW_LOCALNETWORKS = true works as a fairly non-obvious workaround

Originally created by @masche842 on GitHub (Feb 16, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version: 1.13.2 - Git version: 2.26.2 - Operating system: Ubuntu 16.04.6 LTS, Docker image gitea/gitea:1 - Database (use `[x]`): - [X] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [X] No - Logs: [loads of SQL log entries] 2021/02/16 17:35:06 modules/task/task.go:51:handle() [E] Run task failed: migrate from '' is not allowed: unknown hostname ## Description In recent gitea versions importing from local files fails with the error "modules/task/task.go:51:handle() [E] Run task failed: migrate from '' is not allowed: unknown hostname". This appears to be an artifact of #13610 which attempts to verify IP address range even for local files. Consequently setting `[migrations]ALLOW_LOCALNETWORKS = true` works as a fairly non-obvious workaround
GiteaMirror added the topic/repo-migrationtype/bug labels 2025-11-02 07:09:44 -06:00
Author
Owner

@zeripath commented on GitHub (Feb 16, 2021):

See:

https://docs.gitea.io/en-us/config-cheat-sheet/#migrations-migrations

in particular:

ALLOW_LOCALNETWORKS: false: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291

In the [migrations] section in app.ini set:

ALLOW_LOCALNETWORKS=true

@zeripath commented on GitHub (Feb 16, 2021): See: https://docs.gitea.io/en-us/config-cheat-sheet/#migrations-migrations in particular: `ALLOW_LOCALNETWORKS`: false: Allow private addresses defined by RFC 1918, RFC 1122, RFC 4632 and RFC 4291 In the `[migrations]` section in app.ini set: `ALLOW_LOCALNETWORKS=true`
Author
Owner

@lunny commented on GitHub (Feb 17, 2021):

I don't think this is resolved. The problem is the form file:///home/git/repository/a.git is not supported.

@lunny commented on GitHub (Feb 17, 2021): I don't think this is resolved. The problem is the form `file:///home/git/repository/a.git` is not supported.
Author
Owner

@zeripath commented on GitHub (Feb 17, 2021):

Ok well that's slightly different from what the report initially stated. I'll reopen.

@zeripath commented on GitHub (Feb 17, 2021): Ok well that's slightly different from what the report initially stated. I'll reopen.
Author
Owner

@zeripath commented on GitHub (Mar 7, 2021):

I understand now! Sorry it took me so long to get what the problem was.

@zeripath commented on GitHub (Mar 7, 2021): I understand now! Sorry it took me so long to get what the problem was.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6877