Just like CentOS 7, CentOS 8 provides git as a part of repository. You can simply install it by yum - it is super straightforward and easy in terms of server's point of view. It requires just creating an account for git and running couple of commands.

List of content

STEP 1. Setup Git server

To install Git server on CentOS 8, you will need to run below command line with root permission.

sudo yum install git-core

Once installation is done correctly, you will need to create a user git as following:

sudo useradd git
sudo passwd git

STEP 2. Setup a Repository in your Git Server

The first action you should do is naming your repository. I will name it as chun in this case. For project chun, you will need to run below commands. 

sudo su git
mkdir -p /home/git/chun.git
cd /home/git/chun.git
git init --bare --share

STEP 3. Add client's public key to /home/git/.ssh/authorized_keys

Now you will need to setup your client in order to do the next steps. Regarding setup Git client, please refer one of belows:

Once you have a public key, you can do the next steps.

Connect to your Get server by SSH, and run below commands:

sudo su git
mkdir -p ~/.ssh
vim ~/.ssh/authorized_keys

Once you run vim /~.ssh/authorized_keys , you should append the new public key.

For better security, let us change file mode as following:

chmod 700 /home/git/.ssh
chmod 600 /home/git/.ssh/authorized_keys

To be updated

Useful web sites