Use of yum/git in Linux

Table of contents

1. yum

1. About yum

2. Operation of yum

①、yum list

②、yum install

③、yum remove

2. git

1. Connect to gitee in Linux

2. git operation

①git add [file]

②git commit -m "commit log"

③git push

3. Possible problems

①Configure username and email

②A submission conflict occurs

③Don’t want to submit files with certain suffixes

④If you want to delete a file


1. yum

1. About yum

Linux package manager yum

Yum in Linux is actually equivalent to the function of the application market on mobile phones.

yum has the functions of searching, downloading, installing, and resolving dependencies

Run ls /etc/yum.repos.d in Linux to view your own yum source (a configuration file)


2. Operation of yum

①、yum list

yum list is to list all the software that you can install.

Generally, pipes and grep are used in combination with yum list, that is:

yum list | grep [search software keywords]

②、yum install

yum install is the installation software

Generally, higher permissions are required when installing software. Ordinary users should bring sudo when installing.

For example, if we want to install a software called a, we can directly execute sudo yum install a

There is also a -y option, because sometimes when we install, we will be prompted to choose y/n, that is, whether to confirm the installation. If you bring the -y option, you will not be asked again. The default is to install it uniformly.

So usually sudo yum install -ya

③、yum remove

yum remove is uninstall software

When you want to uninstall a software that has been installed before, enter sudo yum remove a, or you can bring the -y option


After sudo yum install lrzsz is installed, you can drag desktop files into Xshell for use.


2. git

git is a version controller

1. Connect to gitee in Linux

First create a warehouse in gitee. After the creation is completed, this page

Click to clone/download:

Click to copy

Then enter git clone [the address just copied] in Linux

Then enter your gitee account password and the connection is completed, as shown below:


2. git operation

How to submit the code we wrote in Linux to gitee, there are three steps:

①git add [file]

Add your code to the local repository

②git commit -m "commit log"

Submit code to the warehouse

The submission log here needs to clearly describe your changes, why you want to change them, code information, etc.

Operation as shown below:


③git push

Submit code to remote repository

You need to enter your own gitee account and password for git push (you can also change it to not need to enter the account and password after you become proficient in subsequent operations)

At this point, the entire process of submitting code to the warehouse has been completed.


As shown in the figure below, the test.c file just created in Linux was successfully transferred to the remote warehouse gitee. The blue circle in the red box is the commit log we just entered when git commit, which can be clearly seen.


If you want to view the commit record, enter git log

You can view your username, email, submission records, etc.

3. Possible problems

①Configure username and email

If there is such a prompt when typing

Then copy the content in the red box, then change the email address and user name and press Enter

Then re-enter the related operations of the git commit just now


②A submission conflict occurs

For example, if a warehouse is used by two people, and one of them submits a file to the remote warehouse, but the other person does not update it, a submission conflict will occur. The solution is for the other person to enter git pull to update it .


③Don’t want to submit files with certain suffixes

If you do not want to submit files with certain suffixes to the remote git repository, you can add them to .gitignore 

If we do not want files with the suffix .m to be uploaded, then vim .gitignore first

Then this page appears:

Then add:

Write whatever you want after the # number, add the suffix you don’t want to add after * on the next line , then save and exit.

At this time, we have the .m suffix. After git add, commit, and push in Linux, we found that there are files ending in .m in the Linux warehouse, but in fact there are no .m files in the remote warehouse.

④If you want to delete a file

If we want to delete a file in the remote warehouse, it is also very simple

If you want to delete the test.c file, directly git rm test.c. At this time, it is deleted in the Linux warehouse. Then repeat git add, commit, and push to complete the deletion operation.

Guess you like

Origin blog.csdn.net/m0_64411530/article/details/132815735