How to make a project into gitlab and upload your existing code into gitlab

Farzanajuthi
3 min readApr 2, 2022

--

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Git tracks the changes you make in your files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all be merged into one source.

Process:

You have to follow the following steps to create a new project and upload your existing code into this project.

Step 1: First browse the link https://about.gitlab.com/ and click on the “Login” button and then login into the system by your gitlab credentials.

Step 2: Then click on “New Project” button and you will get pages like following:

Step 3: Then select “Create blank project ”and fill-up the fields like following:

Step 4: You have to uncheck the “Initial repository with a README” checkbox if you want to push an existing repository in this project. As I will sync my created SAM project to git, I have unchecked this field.

Step 5: Then click on the “Create Project” button.
Step 6: After that open terminal into your pc and and go to your project folder which you want to upload into git. Then give an “Enter”.

cd <project_path>
Example: cd Documents/my_project/tutorial-backend

Then you have to run following commands:

a. git init — initial-branch=main
b. git remote add origin https://gitlab.com/<user_name>/<project_name.git>

Example: git remote add origin https://gitlab.com/farzanarahmanjuthi/tutorial-backend.git

c. git add

d. git commit -m “Initial commit”

e. git push -u origin main

Step 7: Then refresh the gitlab project page and you can see recently uploaded code like following:

Step 8: Then create a new branch by clicking on “New branch”:

Step 9: Then create “master branch” from “main branch” like following:

Step 10: Then create another branch “dev” from “master branch” by clicking on master.

--

--

Farzanajuthi

I am an AWS community builder. I have passed AWS certified solution architect (CO3) exam). I love serverless technology and also share knowledge with others.