How to create a new gitlab repo from my existing local git repo, using CLI?

Jitendra Vyas picture Jitendra Vyas · Oct 13, 2015 · Viewed 83.1k times · Source

I have many local git repos on my OSX. Using command line I want to make new gitlab repos on https://gitlab.ccompanyname.com, form existing local repos.

Is it possible to do that?

Answer

twk3 picture twk3 · Oct 13, 2015

Create new empty projects in GitLab for each of your local repos you want to push to GitLab. After you create the project's, you will be taken to the default project page.

Then cd into each of your existing git repos. Do a git remote add origin <your new gitlab repo address>

And then a git push -u origin master

You will need to do this for each of your repos you want to add.

Your repo address is given to you on the project page. As http and/or ssh. If you already have a remote called origin on your local machine, you might want to rename it first. Or you can call the gitlab one something different. Also if you want to push all your branches to gitlab you can do a git push --all origin If you want your tags, git push --tags origin