How to upload local projects to Gitlab detailed process steps

Upload local projects to Gitlab

Table of contents

Upload local projects to Gitlab

Step 1: Open gitlab and create a new warehouse springboot-rabbitmq:

Step 2: Find the local file, right-click Git Bash Here. 

Step 3: Initialize the local warehouse:

 Step 4: Add all modified or newly added files in the current directory to the temporary storage area

Step 5: Used to create a commit from the changes in the stage

Step 6: Establish the relationship between the local warehouse and the remote warehouse and push

Step 7: Push the local content to the remote warehouse


Scene introduction:

Everyone needs to back up the team development and some codes (to prevent them from being found after being deleted), then you need to upload your project to Gitlab. This tutorial will definitely be useful to you. 

For example, upload the local springboot-rabbitmq to gitlab:

Step 1: Open gitlab and create a new warehouse springboot-rabbitmq:

Remarks: The gitlab page is in Chinese mode, which can be configured in the preferences.

Enter the project name: springboot-rabbitmq, click New Project

 

Successful creation shows that the default master branch of gitlab is main:

 Why is the newly created gitlab default branch main?

在 GitLab 中,创建项目时默认的主分支名称是 main,而不是传统的 master。
这是由于一些 Git 社区的努力来消除包含 master 分支的术语,以促进更加包容和多样化的语言。

 Next around: After creating a new project on gitLab, upload the local project code to the remote introduction

Step 2: Find the local file, right-click Git Bash Here. 

Step 3: Initialize the local warehouse:

git init 

After the initialization is complete, the local file will generate a .git file

 Step 4: Add all modified or newly added files in the current directory to the temporary storage area

git add .

Step 5: Used to create a commit from the changes in the stage

git commit -m 'commit note name'

Step 6: Establish the relationship between the local warehouse and the remote warehouse and push

git remote add origin http://ip address+port/path/(project name).git 

The gitlab warehouse gets the address of the previously built project, and then establishes the relationship between the local warehouse and the remote gitlab warehouse:

1. Find the http address on gitlab, clone it, and change 4492c9d4d2e9 to the specified ip address

http://4492c9d4d2e9/root/springboot-rabbitmq.git
改为后
http://192.168.137.128:8090/root/springboot-rabbitmq.git

Full command:

git remote add origin http://192.168.137.128:8090/root/springboot-rabbitmq.git

Check if the connection is successful:

git remote -v

If the connection is wrong: execute the change command, git remote rm origin, and reconnect  

Step 7: Push the local content to the remote warehouse

When operating this step, you need to pull the master code of the remote warehouse first

git pull --rebase origin master

This step: If the remote has no master code, as shown in the figure. Pull if available

Local content to remote warehouse:  

git push -u origin master

Operation complete. View the content of the previously created project on gitlab, and you can see that all the contents of the local project have been pushed to gitlab:

Select the master master branch:  

This is the complete process of uploading a local project to gitlab, I hope it will be helpful for novice friends! ! ! If it is helpful to you, I hope you will like your little finger to give the author a support and encouragement! ! !

Guess you like

Origin blog.csdn.net/weixin_56602545/article/details/130701698