Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the installation and basic configuration of the Git client in CentOS

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the installation and basic configuration of the Git client in CentOS. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Installation

Current projects use GIT for version management, so it's time to learn about GIT installation. This article describes the compilation and installation of git1.9.0. Although it is now 2.6.

All commands should be carried out under root.

The first step is to install the dependency package.

Before you start compiling and installing git, you should first install the necessary dependency packages to avoid problems during the installation process.

The code is as follows:

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker

The second step is to download and compile git.

You can download the version you need from kernel.org, or download version 1.9.0 directly as I did.

Change to the src directory, download and extract the git source code.

The code is as follows:

# cd / usr/src

Wget https://www.kernel.org/pub/software/scm/git/git-1.9.0.tar.gz

Tar xzf git-1.9.0.tar.gz

Go to the extracted git directory and execute the compilation.

The code is as follows:

# cd git-1.9.0

# make prefix=/usr/local/git all

# make prefix=/usr/local/git install

# echo "export PATH=$PATH:/usr/local/git/bin" > > / etc/bashrc

# source / etc/bashrc

Step three, finish.

Now that you have successfully installed git, you can execute the following command to view the git version.

The code is as follows:

# git-version

Versions of git2.4 and above are now included in fedora22.

Simple configuration

We generate the public key and copy it to the server:

The code is as follows:

[root@test] # ssh-keygen-t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/ root/.ssh/id_rsa):

Created directory'/ root/.ssh'.

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in / root/.ssh/id_rsa.

Your public key has been saved in / root/.ssh/id_rsa.pub.

The key fingerprint is:

48:3c:22:76:02:f1:a2:e5:27:22:cb:4f:a7:a0:98:9d root@test.com

[root@test ~] # cat .ssh / id_rsa.pub

Ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwrmgNAca77BKzXl6BP11fdaclAoWfW+x4kPDZMPj1zFoML9JfOAS7DGY9quLMitwwfg5+U7zP/egPmAhSKCECubmodzMucnRSkJGgKCt1SlctRNDRN3OIvrecAtdZfDcBaWKLjaVzGPmhweLhr6HzfqeZU09Ccis4yK3RMwip2f+K1ZZVIOKUmL4AVFl9dqtxnQ4HlW61PUxvM/ug2M68Z0jQk5DVG8w5+dvGqX1qr5YABD1NX5Jz6aUbVVx7yyoORENxu6SK83GI/V7eOkrvBMDh9nDdwvDhPhuhBDSfE+Xi92hPJPKdNroF1vx8HMvpHME20MmjSwavPrz+B18MQ== root@test.com

Let's copy the public key from id_rsa.pub to the server's authorized_keys file.

The code is as follows:

[root@git ~] # su git

Bash-3.2$ cd

Bash-3.2$ vim .ssh / authorized_keys

Ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwMU4FKB6NRc3XSoIunWsdvVVuSoncbVb5Al6lB3ciswBVd++YmJFhqwkITNGccrO5sycROs9+Fbjgd6oBSzNuaBtCIbwNNsEyM/henTl2euI3XsnJQ/ITr6c/q0P3WoGl4E2QFQ2kZqs+1eDC0CgHcBrqvFv1Jr414sVYK9lfZwIF+jDdtaBOrSJuq1Agx9pGUFUEB4tQfkXxsWm/MvOmKAVvduKDE1eenUEL9zzyeELPcSXLe3NOoTjZhkX6EEXxQR1ZiZRFywLpfM4qopZ10to2KIUyVtzw6hx6V3cg7kn40lYVW0EAMATw9dVldwcRUI+kJzJSKUTKDVSwY3/+Q== root@CHENMINGQIAN

Ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsmmJuR+KhRSpdSirCiL30RA8WbfgicY1z7itWVnKHJW6hTuJFhzruY59FilVjJR1hbQBluP9JnK3XPSK9PSg+bwiJ2iQRa39rXck35r+trVOLyNbPyfKVRfOemD8YuykMlyr5JeW8gZjsHEuLnJ8//RiCiYzd3RT/SSUQ4yawDoIIWkz3eUSL09xoCRZFBsAp+S/LD3vx2MN+FNOHwvqcE+yK3oRNIqjWwLoKE0e5TRnqNgrPQ95PJYB3XPUulzaeMwsWPZs7jIUMl/5yEqSgAkioa8SVMOsikYJG/erv99NNVgFmpCBIiWqKEGkNrIpYzLLHDSYQ4g5Gbci/RZ54Q== Administrator@WIN2003X323

Ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NwUHeNNi+PC6KlrcJrXXDmKxRMmgHIPp79sgX6zqfdSlmNj7rBPQeyEKS9Wg8yI6jd8aG2jsUx99Vjti2VK2vEXKkRHxwID7ri69gE71RfDtv6ekafnzLo14J8hAp0spMk+N3wEAQRYDmcYo1wmnm/jMBedGrHj4NJQ1vYy1hVtJasGMSzjcMrlz9qvaluWnQ5tQjKFQVVwKsRRRzs8qTvzVhLJt4NQ+CAN45tqfsRuf58Uba9QNK7/6xSUiIKXQiILz8PMGJ3MnlV+eN3wx2aeztdevxu9plggtG05SMmd8GNVzXrN1IaxXSvz0UwjQ2kygu7aCqO8AZWH49rouw== leo@LEO-PC

Ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwrmgNAca77BKzXl6BP11fdaclAoWfW+x4kPDZMPj1zFoML9JfOAS7DGY9quLMitwwfg5+U7zP/egPmAhSKCECubmodzMucnRSkJGgKCt1SlctRNDRN3OIvrecAtdZfDcBaWKLjaVzGPmhweLhr6HzfqeZU09Ccis4yK3RMwip2f+K1ZZVIOKUmL4AVFl9dqtxnQ4HlW61PUxvM/ug2M68Z0jQk5DVG8w5+dvGqX1qr5YABD1NX5Jz6aUbVVx7yyoORENxu6SK83GI/V7eOkrvBMDh9nDdwvDhPhuhBDSfE+Xi92hPJPKdNroF1vx8HMvpHME20MmjSwavPrz+B18MQ== root@test.com

Let's clone a warehouse to a local directory.

The code is as follows:

[root@test ~] # cd / data/dev

[root@test dev] # git clone git@git.jjhh.com:/data/git/project.git

Cloning into 'project'...

The authenticity of host 'git.jjhh.com (114.112.173.150)' can't be established.

RSA key fingerprint is ca:ec:a2:7e:e6:89:ca:19:d3:93:7f:4b:c3:c0:c7:fd.

Are you sure you want to continue connecting (yes/no)? Yes

Warning: Permanently added 'git.jjhh.com,114.112.173.150' (RSA) to the list of known hosts.

Remote: Counting objects: 50, done.

Remote: Compressing objects: 100% (42 scarp 42), done.

Remote: Total 50 (delta 21), reused 0 (delta 0)

Receiving objects: 100% (50 amp 50), 4.02 KiB, done.

Resolving deltas: 100% (21 percussion 21), done.

[root@test dev] # ls

Project

[root@test dev] # cd project/

[root@test project] # ls

Index.html

On the CentOS Git client installation and basic configuration is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report