While looking into how to import a Git repository through the GitLab API, into GitLab, my search results appear to be polluted by methods to mirror a GitHub repository into GitLab using ssh. I'm trying to do the CLI/Bash equivalent of going to: http://127.0.0.1/projects/new#import_project on a self-hosted GitLab server, and entering:
http://www.somegit.com/somegituser/somegitrepository.git, as visualised below:
Except, using the GitLab API (and a personal access token). So I looked at the GitLab documentation and ran:
curl --request POST --header "PRIVATE-TOKEN: $personal_access_token" "http://127.0.0.1/api/v4/projects/1/export" \
--data "upload[http_method]=PUT" \
--data-urlencode "upload[url]=http://www.somegit.com/someuser/somegithubrepository.git"
Which returns:
{"message":"202 Accepted"}(base)
However, the repository does not appear in the GitLab server. Hence, I was wondering: How can I add an arbitrary public git repository to a self-hosted GitLab server using the import method and the GitLab API (without using ssh for GitLab)?