Git installation and local warehouse creation and configuration


insert image description here

1. Introduction to Git

Git is a distributed version control system used to track and manage changes to files. It can record and store all historical versions of the code, and facilitate branch management, code merging and collaborative development.

2. Install Git

This article mainly introduces the installation of Git on Centos and ubuntu

2.1 Install git on CentOS

Install git command:

sudo yum install git -y

After entering the command, you can start downloading and installing git.

Use the view version command to check whether the installation is successful

git --version

insert image description here
You can see that the installation is successful here. The version is 1.8.3.1

2.2 Install git on ubuntu

Install git command:

sudo apt-get install git -y

After entering the command, you can also use git --versionthe command to check whether the installation is successful

3. Create a local warehouse

The local warehouse needs to be created in a directory, so first select a directory and use cdthe command to enter this directory.

Execute the following Git command to create a local repository:

git init

Execution result:
insert image description here
Enter ll -ato view the current directory: you can see that there is a hidden file
insert image description here
here.git

4. Configure the local warehouse

After the local warehouse is created, configure the local warehouseuser.name 和 user.email

git config [user.name/user.email] []

The command to check whether the configured properties are correct is as follows:

git config -l

Delete the configuration information of the local warehouse

git config --unset [user.name/user.email] 

git configCommands can be followed by --globaloptions.

git config --global  [user.name/user.email] []

Note: global means global.

Multiple local warehouses can be created on one server, with --globalthe option, indicating that the current command can be applied to all local warehouses

The same is true for deletion, the command is as follows:

git config --global --unset [user.name/user.email]

insert image description here

Guess you like

Origin blog.csdn.net/m0_63463510/article/details/131976861