How to Create a New Gitlab Repo from My Existing Local Git Repo, Using Cli?

I have many local git repos on my OSX. Using the command line I want to make new gitlab repositories on from existing local repositories.

Is it possible to do that?

5

4 Answers

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 :username/new-repo.git master

# To gitlab.com with HTTP
git push --set-upstream  master

This will create a new project on Gitlab without you creating it manually on the server


Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.