2018 Solution: just use --set-upstream
Assuming you’ll take care of writing the script that would do the following for each of your local repo, it seems that as of Gitlab 10.5 you can simply use
# To your own domain
git push --set-upstream address/your-project.git
# To gitlab.com with SSH
git push --set-upstream git@gitlab.example.com:username/new-repo.git master
# To gitlab.com with HTTP
git push --set-upstream https://gitlab.example.com/username/new-repo.git master
This will create a new project on Gitlab without you creating it manually on the server
From the Documentation
Push to create a new project
When you create a new repository locally, instead of manually creating a new project in GitLab and then cloning the repository locally, you can directly push it to GitLab to create the new project, all without leaving your terminal. If you have access rights to the associated namespace, GitLab automatically creates a new project under that GitLab namespace with its visibility set to Private by default (you can later change it in the project’s settings).
This can be done by using either SSH or HTTPS:
## Git push using SSH
git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master
## Git push using HTTPS
git push --set-upstream https://gitlab.example.com/namespace/nonexistent-project.git master
You can pass the flag
--tagsto thegit pushcommand to export existing repository tags.Once the push finishes successfully, a remote message indicates the command to set the remote and the URL to the new project:
remote:
remote: The private project namespace/nonexistent-project was created.
remote:
remote: To configure the remote, run:
remote: git remote add origin https://gitlab.example.com/namespace/nonexistent-project.git
remote:
remote: To view the project, visit:
remote: https://gitlab.example.com/namespace/nonexistent-project
remote: