Build an open source project, two ways to install git detailed tutorial

Time:2020-10-24

1、 Start tool installation

1.git

  • There are two ways to install git tools, one is to use the package management tools, the other is to compile and install the source code
  • (1) Because CentOS already has a package manager, you only need a single line of command to install it automatically

yum install git

(2) First, Download git root and install the package by yourself

The moving track can be seen from the figure. Use the decompression command to decompress it to get the directory git-2.28.0


tar -zxvf 

Review tar is used to create, restore the backup file of the tool program, it can join, untie the file in the backup file.
Parameters:
-Z or — gzip or — ungzip processes the backup file through the gzip instruction.
-X or — extract or — get to restore a file from a backup file
-V or — verb shows the execution of an instruction.
-F < backup file > or — file = < backup file > specifies the backup file.
reference resources: https://www.jb51.net/article/103657.html

Next, install the various dependencies


yum install curl-devel gettext-devel openssl-devel zlib-devel gcc-c++ perl-ExtUtils-MakeMaker

Compile and install git tools, enter the directory git-2.28.0, and execute the commands of configuration, compilation and installation


cd git-2.28.0
make configure
./configure --prefix=/usr/local/git
make profix=/usr/local/git
make install

Review:. / configure is used to detect the target characteristics of your installation platform. For example, it will detect whether you have CC or GCC, and it doesn’t need CC or GCC. It’s a shell script.
Make is used to compile. It reads instructions from makefile and compiles.
Make install is used to install. It also reads instructions from makefile and installs to the specified location. “

Next, configure the environment variables, GIT executable program added to the environment variables into the configuration file


vim /etc/profile

Add a statement to the end of the file


export GIT_HOME=/user/local/git
export PATH=$PATH:$GIT_HOME/bin

Final executionsource /etc/profileIt is the environment variable that takes effect

Review: 1. In Linux and UNIX sh, strings starting with $indicate variables defined in SH. these variables can be automatically added by the system or defined by the user. The $path represents the system command search path, which is the same as% path% of windows. And $home represents the user’s home directory, which is the user’s working directory after login
2. Source reads and executes the commands in the file name in the current bash environment.
*Note: this command is usually replaced by the command “.”.
Examples of use:
source filename
. filename ා (with space in the middle)
The source command (from the C shell) is a built-in command for the bash shell. The dot command, which is a dot symbol, (from Bourne shell), is another name for source.
Similarly, the variables configured in the current script will also serve as the script environment. The source (or point) command is usually used to re execute the newly modified initialization document, such as. Bash_ Profile and. Profile, etc
Quoted from: https://www.cnblogs.com/xuange306/p/9436126.html

Finally, check the usagegit --versionView installation results

PS: let’s take a look at the two installations and uses of GIT

1. Installation under Windows

2. After installing eclipse plug-ins, it is easy to install related plug-ins

This paper focuses on the second way. After Git is installed, you can set up your local warehouse. The local warehouse is equivalent to your cache. You commit the written code to the local warehouse, and then you can push the code of the local warehouse to your remote warehouse. If you want to have a remote warehouse, you can register an account with githb (a git website) My account is ybfybf, (remember this account and password, because you will use it when pushing code) and then you can create your remote repository. Here we will talk about public key and private key. Their specific role is to prevent the code of your remote repository from being leaked. You can set your public key and private key on eclipse, and then your. SSH file will have ID_ RSA (your private key file) and ID_ rsa.pub (your public key file), copy your public key file, it is equivalent to your local ID, sent to the remote warehouse for management, so you can download code from the remote warehouse.

summary

This article about building an open source project two ways to install git detailed tutorial article introduced here, more related git two kinds of installation content, please search the previous articles of developeppaer or continue to browse the related articles below, I hope you can support developeppaer more in the future!