Article directory
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
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 --version
the 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 cd
the command to enter this directory.
Execute the following Git command to create a local repository:
git init
Execution result:
Enter ll -a
to view the current directory: you can see that there is a hidden file
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 config
Commands can be followed by --global
options.
git config --global [user.name/user.email] [值]
Note: global means global.
Multiple local warehouses can be created on one server, with --global
the 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]