create a GitLab repo remotely from existing code

Ivory Wolf
Dec 30, 2020

--

So, have you been noodling and want to send that code somewhere safe?

First, add a .gitignore file so you don’t add build or debug artifacts!

Then, open a command prompt in the root of your code folder:

git init
git add .
git commit -m "initialise repo with existing files."

The basic git steps apply to ant new repo. Now we need to create the GitLab repo.

git push --set-upstream https://gitlab.com/username/repo-name.git master

This command will return a message that includes a final instruction:

"To configure the remote, run: 
git remote add origin https://gitlab.com/username/repo-name.git"

Run this final command and you should now see the new repo and code in Gitlab.

https://gitlab.com/username/repo-name.git

--

--

Ivory Wolf
Ivory Wolf

No responses yet