This SSH method assumes your SSH keys are already set up on Gitlab and your local system. The SSH method is preferable as it doesn't require a username and password like the HTTPS method.
In the commands below replace fospathi and nonexistent-project with your username and project name respectively. Execute these commands in the project's top-level directory which usually contains the project's .git directory and other language specific things like a go.mod file for Go modules.
Directly push the repo to GitLab to create the new project (some times this step takes multiple attempts before success):
git push --set-upstream [email protected]:fospathi/nonexistent-project.git masterIts visibility is set to Private by default (you can later change it in the project's settings).
git remote add origin [email protected]:fospathi/nonexistent-project.gitgit push -u origin masterIf you're curious about the -u option see why the -u?