Use of IntelliJ-IDEA and Git and Gitlab

1. Basic introduction

1. IntelliJ-IDEA pre-installed version control introduction

Let's look at the version control settings area of ​​IntelliJ-IDEA and 
open File>Settings>Version Control 
Version Control Settings Area 
to see that there are git plugins in it

This makes many people think that IntelliJ IDEA comes with version control tools such as SVN or Git, and that as long as IntelliJ IDEA is installed, it can fully use the functions of version control. This is a completely wrong interpretation. IntelliJ IDEA comes with support plug-ins for these version control tools, but the version control client that should be installed still needs to be installed. 
As you can see above, it also comes with a github plugin, this is because too many people currently use Github for collaboration or project version management

2. Configuration of git.exe and Github

1. Configure git.exe

Make sure you have Git and TortoiseGit installed on your computer and 
then configure the git client 

Configure the git client


Use of Gitlab

Gitlab is similar to Github in that they are both code hosting websites. The biggest difference is that projects created by Gitlab can be privately owned for free and do not have to be charged like Github, and Gitlab can also build its own private server. Therefore, open source projects are generally placed on Github, personal private projects can be placed on Gitlab on the public network, and company private projects can be placed on Gitlab built by themselves.

1. Create a project

2. Operate on the project

After the project is created, you can click on the upper left corner to view 
write picture description here 
and click on Project, you can see the list 
project list 
of projects. You can add a README.md to  the  project and then
write picture description here 
clone the specified project.  Use Git on IntellIj-IDEA to clone it  as shown in the figure above. When checking out the project, because it is not Github, you no longer choose Github, but choose ordinary Git to clone the project.  Finally, enter the password, and then clone it and  clone it. After that, the project structure is as follows:  At this time, normal add, commit, and push operations can be performed.
Copy clone connection


select git 

Enter the relevant configuration 

enter password 

Project structure 

3. Publish the project to gitlab

First create a project locally 
and add the project to version control. 
write picture description here 
After adding it to version control, we can see that the files have turned green. 
add to version control 
Then submit the project locally and 
write picture description here 
fill in the relevant information  to be submitted.
Submit code to local 
Note that perform code analysis  is not checked. This option will automatically check the code, which will be very slow. 
Then push the project to the server and 
click push  .
click push 
Next, you need to define the remote service. 
Set up remote services 
At this time, you need to set the url in the pop-up box. We first create a new project in gitlab. The purpose is to After obtaining the relevant url 
, fill in the url, and then click push. 
click push 
At this time, you also need to fill in the password on gitlab. 
write picture description here 
After the push is successful, such a prompt will appear. This is a successful prompt: 
Tips for success 
check the project information on gitlab again, and you can see the submitted code , as shown in the figure below 
write picture description here


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325810326&siteId=291194637