Idea + git + gitlab

Time:2021-1-28

Gitlab installation pit

502 error code and solution to access stuck

![在这里插入图片描述](https://img-blog.csdnimg.cn/20201108213830454.png#pic_center

Gitlab is too laggy for memory, and my server Centos 7+2 core +2G memory, frequently reported 502 errors, and access is also very stuck. The reason may be that there is too little available memory.
#Free – M view available memory

在这里插入图片描述

We can see that there is not much free. The solutions include expanding memory or using virtual memory. Let’s see how to use virtual memory.

1. Add swap exchange file

1) Create a swap file with the DD command

dd if=/dev/zero of=/home/swap bs=1024 count=2048000

In this way, a partition file of / home / swap is created, which is 2G in size and can be multiplied by itself.

2) Make it into swap format file:

mkswap /home/swap

3) Then use the swap command to mount the file partition to the swap partition

swapon /home/swap

Let’s take a look with the free – M command and find that there are already swap partitions.

在这里插入图片描述

2. To prevent the swap partition from becoming 0 after restart, modify the / etc / fstab file

vi /etc/fstab

Add the

/home/swap swap swap default 0 0

In this way, even if the system is restarted, the swap partition still has a value.

Gitlab and git use SSH key

Using SSH key allows us to add a key to the project to pull, push and other operations without frequent password input. (SSH)

1、 Git configuring global users

git config –global user.name=“your name”
git config –global user.emal=“your email”

2、 Generate SSH key

ssh-keygen -t rsa -C “[email protected]

Then, Windows users can see the generated key in the folder of C: / / users \ \ user name. SSH

在这里插入图片描述

3、 Adding SSH key to gitlab

Gitlab添加ssh key

The ID that will be generated_ rsa.pub The content is copied and pasted to the key. Generally, the title is not filled in. The mailbox filled in when the key is generated will be used automatically. (SSH should be used instead of HTTP when cloning code repository)

Idea uses git for code version management

1、 Install Git

Learning with one mind

2、 Idea configuration Git

在这里插入图片描述

choice Git.exe Path, click test to test whether it works normally.

在这里插入图片描述
在这里插入图片描述

3、 Idea uses git to import projects quickly

在这里插入图片描述
在这里插入图片描述

4、 Common operations

Common shortcut keys:
Add:Ctrl+Alt+A
Commit:Ctrl+K
Push:Ctrl+Shift+K

在这里插入图片描述

Here is the article about idea + git + gitlab detailed tutorial. For more information about idea + git + gitlab, please search previous articles of developer or continue to browse the following articles. I hope you can support developer more in the future!