API: POST /projects with import_url results in: "is not a valid HTTP Git repository"
I try to use the Rest API to create a new project (POST /projects
) and have it automatically import from an existing Mercurial repository by specifying import_url
.
This works just fine in the UI, but fails in the API with:
{"message":"http://.... is not a valid HTTP Git repository"}
From a quick glance at the source code, in lib/api/projects.rb
there is a call to validate_git_import_url()
, which seems to check for a Git repository and doesn't know about Mercurial.
Example curl
call:
curl -s --header 'PRIVATE-TOKEN: API_TOKEN' --header 'Content-Type: application/json' --data '{"path":"my-repository","import_url":"http://user:password@hg.local/my_repository"}' http://gitlab.local/api/v4/projects