gerrit配置和使用
参考http://www.cnblogs.com/tesky0125/p/5973642.html
1.安装gerrit replication插件
mkdir ~/tmp
cp gerrit-2.14.war tmp
cd tmp
unzip gerrit-2.14.war
cd WEB-INF/plugins
[gerrit2@pre-srv44 plugins]$ pwd
/home/gerrit2/tmp/WEB-INF/plugins
##ssh -p 29418 gerrit2@172.16.181.60 gerrit plugin install -n replication.jar - <replication.jar
##ssh -p 29418 gerrit2@172.16.181.80 gerrit plugin ls
[gerrit2@pre-srv44 .ssh]$ alias
alias ssh-gerrit='ssh -p 29418 -i ~/.ssh/gerritadmin 172.16.181.80 -l gerrit2'
等价于ssh -p 29418 -i ~/.ssh/gerritadmin gerrit2@172.16.181.80
[gerrit2@pre-srv44 .ssh]$ ssh-gerrit gerrit plugin ls
Name Version Status File
-------------------------------------------------------------------------------
[gerrit2@pre-srv44 .ssh]$ ssh-gerrit gerrit plugin install -n replication.jar - </home/gerrit2/tmp/WEB-INF/plugins/replication.jar
fatal: remote installation is disabled
[gerrit2@pre-srv44 .ssh]$ git config --file /home/gerrit2/gerrit_site_http/etc/gerrit.config plugins.allowRemoteAdmin true
[gerrit2@pre-srv44 etc]$ ssh-gerrit gerrit --help
[gerrit2@pre-srv44 etc]$ ssh-gerrit gerrit flush-caches
[gerrit2@pre-srv44 bin]$ ./gerrit.sh start
Starting Gerrit Code Review: OK
[gerrit2@pre-srv44 .ssh]$ ssh-gerrit gerrit plugin install -n replication.jar - </home/gerrit2/tmp/WEB-INF/plugins/replication.jar
[gerrit2@pre-srv44 bin]$ ssh-gerrit gerrit plugin ls
Name Version Status File
-------------------------------------------------------------------------------
replication v2.14 ENABLED replication.jar
replication安装成功
gerrit增加ACCESS权限
Global Capabilities
Create Account: Administrators
Create Group: Administrators
等
### 以下斜体字可以忽略
[gerrit2@pre-srv44 .ssh]$ ll
total 24
-rw-r-x---+ 1 gerrit2 root 1675 Jun 12 09:59 admin
-rw-r-xr--+ 1 gerrit2 root 387 Jun 12 09:59 admin.pub
-rw-r--r-- 1 gerrit2 root 112 Jul 8 17:37 config
-rw------- 1 gerrit2 root 1675 Jun 24 10:56 gerritadmin
-rw-r--r-- 1 gerrit2 root 393 Jun 24 10:56 gerritadmin.pub
-rw-r--r-- 1 gerrit2 root 1202 Jul 8 17:09 known_hosts
“+” 什么意思
[gerrit2@pre-srv44 .ssh]$ vi config
Host hostgitlab
Hostname gitlab.test.mycompany.com
User git
IdentityFile ~/.ssh/admin.pub
[gerrit2@pre-srv44 devwork]$ git clone hostgitlab:dev_group/test_project1.git
Cloning into 'test_project1'...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0654 for '/home/gerrit2/.ssh/admin.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /home/gerrit2/.ssh/admin.pub
git@gitlab.test.mycompany.com's password:
Permission denied, please try again.
IdentityFile ~/.ssh/admin.pub 用公钥不对,应该指定私钥
[gerrit2@pre-srv44 .ssh]$ vi config
Host hostgitlab_admin
Hostname gitlab.test.mycompany.com
User git
IdentityFile ~/.ssh/admin
Host hostgitlab_gerritadmin
Hostname gitlab.test.mycompany.com
User git
IdentityFile ~/.ssh/gerritadmin
[gerrit2@pre-srv44 devwork]$ ssh -T hostgitlab_gerritadmin
Welcome to GitLab, gerrit2!
[gerrit2@pre-srv44 devwork]$ ssh -T hostgitlab_admin
Welcome to GitLab, gerrit2!
都成功了
ssh -vT hostgitlab_admin 调试
Gitlab上设置test-project1工程
前面我们在Gitlab上搭建了一个 test_project1 的工程,普通用户是没有办法去 push 的,只能使用 git review 命令提交. 而 git review 命令需要 .gitreview 文件存在于项目目录里。
用 gerrit2用户添加.gitreview 文件(只有gerrit2用户是项目创建者,可以直接push,其他用户只能git review)
[gerrit2@pre-srv44 ~]$ cd devwork/
[gerrit2@pre-srv44 devwork]$ ls
[gerrit2@pre-srv44 devwork]$ git clone hostgitlab_admin:dev_group/test_project1.git
Cloning into 'test_project1'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 11 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (11/11), done.
[gerrit2@pre-srv44 devwork]$ ls
test_project1
[gerrit2@pre-srv44 devwork]$ cd test_project1/
[gerrit2@pre-srv44 test_project1]$ vim .gitreview
[gerrit]
host=gitlab.test.mycompany.com #此处写错了,应该是host=172.16.181.80 gerrit地址 写作gitlab地址错误,后改正
port=29418
project=test_project1.git
[gerrit2@pre-srv44 test_project1]$ git add .gitreview
[gerrit2@pre-srv44 test_project1]$ git config --global user.name 'gerrit2'
[gerrit2@pre-srv44 test_project1]$ git config --global user.email 'gerrit2@email'
[gerrit2@pre-srv44 test_project1]$ git commit .gitreview -m 'add .gitreview file by gerrit.'
[master 698ca36] add .gitreview file by gerrit.
1 file changed, 4 insertions(+)
create mode 100644 .gitreview
[gerrit2@pre-srv44 test_project1]$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 373 bytes | 373.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To hostgitlab_admin:dev_group/test_project1.git
b0e358d..698ca36 master -> master
[gerrit2@pre-srv44 test_project1]$
Gerrit上设置 test_project1工程
在Gerrit上创建 test_project1 项目
要知道review是在gerrit上,而gerrit上现在是没有项目的,想让gitlab上的项目能在gerrit上review的话,必须在gerrit上创建相同的项目,并有相同的仓库文件.
用gerrit2用户在 Gerrit 上创建 test-project1 项目
[gerrit2@pre-srv44 devwork]$ ssh-gerrit gerrit create-project test_project1
登陆gerrit界面,发现test_project1工程已经创建了。(这种方式创建的项目是空的)
clone --bare Gitlab上的仓库到 Gerrit (gerrit上的项目最好是从gitlab上git clone --bare过来,并且项目不要为空)
[gerrit2@pre-srv44 ~]$ cd gerrit_site_http
[gerrit2@pre-srv44 gerrit_site_http]$ ls
bin cache data db etc git index lib logs plugins static tmp
[gerrit2@pre-srv44 gerrit_site_http]$ cd git
[gerrit2@pre-srv44 git]$ ls
All-Projects.git All-Users.git test_project1.git
[gerrit2@pre-srv44 git]$ cd test_project1.git/
[gerrit2@pre-srv44 test_project1.git]$ ls
branches config HEAD hooks logs objects refs
[gerrit2@pre-srv44 test_project1.git]$ cd ..
[gerrit2@pre-srv44 git]$ ls
All-Projects.git All-Users.git test_project1.git
[gerrit2@pre-srv44 git]$ mv test_project1.git test_project1.git.bak
[gerrit2@pre-srv44 git]$ ls
All-Projects.git All-Users.git test_project1.git.bak
[gerrit2@pre-srv44 git]$ git clone --bare hostgitlab_admin:dev_group/test_project1.git
Cloning into bare repository 'test_project1.git'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 14 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (14/14), done.
[gerrit2@pre-srv44 git]$ ls
All-Projects.git All-Users.git test_project1.git test_project1.git.bak
[gerrit2@pre-srv44 git]$ cd test_project1.git
[gerrit2@pre-srv44 test_project1.git]$ ls
branches config description HEAD hooks info objects packed-refs refs
[gerrit2@pre-srv44 test_project1.git]$
同步 Gerrit的test_project1 项目到 Gitlab 上的 test_project1 项目目录中
当用户git review后,代码通过 jenkins 测试、人工 review 后,代码只是 merge 到了 Gerrit 的 test_project1 项目中,并没有 merge 到 Gitlab 的 test-project1 项目中,所以需要当 Gerrit test_project1 项目仓库有变化时自动同步到 Gitlab 的 test_project1 项目仓库中。
Gerrit 自带一个 Replication 功能可完成同步
现在只需要添加一个 replication.config 给 Gerrit
replication配置
[gerrit2@pre-srv44 etc]$ pwd
/home/gerrit2/gerrit_site_http/etc
[gerrit2@pre-srv44 etc]$ vim replication.config
[remote "test_project1"]
projects = test_project1
url = git@gitlab.test.mycompany.com:dev_group/test_project1.git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
push = +refs/changes/*:refs/changes/*
threads = 3
重启
[gerrit2@pre-srv44 ~]$ ~/gerrit_site_http/bin/gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK
总结一下就是:现在gerrit上创建一个同名的project,然后删除,并在同样的位置从Gitlab克隆过来同名project覆盖。
测试
普通sisi用户
[sisi@pre-srv44 devwork]$ git clone git@gitlab.test.mycompany.com:dev_group/test_project1.git
Cloning into 'test_project1'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 14 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (14/14), done.
[sisi@pre-srv44 devwork]$ ls
test_project1
[sisi@pre-srv44 devwork]$ cd test_project1/
[sisi@pre-srv44 test_project1]$ ls
hello maintain
[sisi@pre-srv44 test_project1]$ touch testfile
[sisi@pre-srv44 test_project1]$ ls
hello maintain testfile
[sisi@pre-srv44 test_project1]$ git add testfile
[sisi@pre-srv44 test_project1]$ git commit -m 'add testfile'
[master a7b5f6c] add testfile
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 testfile
[sisi@pre-srv44 test_project1]$ git review
git: 'review' is not a git command. See 'git --help'.
没有Git review命令,
安装git review
[sisi@pre-srv44 test_project1]$ sudo yum install git-review
测试连接gerrit
[sisi@pre-srv44 test_project1]$ ssh -T -p 29418 sisi@172.16.181.80
The authenticity of host '[172.16.181.80]:29418 ([172.16.181.80]:29418)' can't be established.
RSA key fingerprint is 34:b8:66:84:01:26:96:0a:77:ab:60:0f:07:84:6a:2c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[172.16.181.80]:29418' (RSA) to the list of known hosts.
**** Welcome to Gerrit Code Review ****
Hi sisi, you have successfully connected over SSH.
Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use:
git clone ssh://sisi@172.16.181.80:29418/REPOSITORY_NAME.git
连接成功
[sisi@pre-srv44 test_project1]$ vi .gitreview
[gerrit]
host=172.16.181.80 #gerrit地址 前述写作gitlab地址错误
port=29418
project=test_project1.git
[sisi@pre-srv44 test_project1]$ git review
Creating a git remote called "gerrit" that maps to:
ssh://sisi@172.16.181.80:29418/test_project1.git
Errors running git rebase -p -i remotes/gerrit/master
Cannot rebase: You have unstaged changes.
Please commit or stash them.
有未提交的变更,先提交了再说
[sisi@pre-srv44 test_project1]$
[sisi@pre-srv44 test_project1]$ git add .gitreview
[sisi@pre-srv44 test_project1]$ git commit -m 'mod .gitreview'
[master 45b7d34] mod .gitreview
1 file changed, 1 insertion(+), 1 deletion(-)
再执行Git review
[sisi@pre-srv44 test_project1]$ git review
You are about to submit multiple commits. This is expected if you are
submitting a commit that is dependent on one or more in-review
commits. Otherwise you should consider squashing your changes into one
commit before submitting.
The outstanding commits are:
45b7d34 (HEAD -> master) mod .gitreview
a7b5f6c add testfile
Do you really want to submit the above commits?
Type 'yes' to confirm, other to cancel: yes
remote: Processing changes: refs: 1, done
remote: ERROR: [a7b5f6c] missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 sisi@172.16.181.80:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote: git commit --amend
remote:
To ssh://172.16.181.80:29418/test_project1.git
! [remote rejected] HEAD -> refs/publish/master ([a7b5f6c] missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://sisi@172.16.181.80:29418/test_project1.git'
失败,没有加添加change-id的钩子程序,这是gerrit必须的,按照提示命令执行
[sisi@pre-srv44 test_project1]$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 sisi@172.16.181.80:hooks/commit-msg ${gitdir}/hooks/
commit-msg 100% 4691 4.6KB/s 00:00
[sisi@pre-srv44 test_project1]$ git commit --amend
[sisi@pre-srv44 test_project1]$ git review
You are about to submit multiple commits. This is expected if you are
submitting a commit that is dependent on one or more in-review
commits. Otherwise you should consider squashing your changes into one
commit before submitting.
The outstanding commits are:
6e36ace (HEAD -> master) mod .gitreview
a7b5f6c add testfile
Do you really want to submit the above commits?
Type 'yes' to confirm, other to cancel: yes
remote: Processing changes: refs: 1, done
remote: ERROR: [a7b5f6c] missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote: gitdir=$(git rev-parse --git-dir); scp -p -P 29418 sisi@172.16.181.80:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote: git commit --amend
remote:
To ssh://172.16.181.80:29418/test_project1.git
! [remote rejected] HEAD -> refs/publish/master ([a7b5f6c] missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://sisi@172.16.181.80:29418/test_project1.git'
还是失败是因为多个commit,但是只有之后一个commit有change-id,之前一个没有
[sisi@pre-srv44 test_project1]$ git log
commit 6e36acec3243f1c33959873a30bdbc61ebd600df (HEAD -> master)
Author: sisi <sisi@mycompany.com>
Date: Sun Jul 8 22:45:07 2018 +0800
mod .gitreview
Change-Id: Ie390e2f6c049997d96a1190efc6c66bdbbb078fd
commit a7b5f6cadbd4f3585ceaac7d7a03883dcc60e238
Author: sisi <sisi@mycompany.com>
Date: Sun Jul 8 22:12:52 2018 +0800
add testfile ##这个commit没有change-id
commit 698ca363e60daca3f88760916112855687d9c3f2 (origin/master, origin/HEAD, gerrit/master)
Author: gerrit2 <gerrit2@email>
Date: Sun Jul 8 21:42:24 2018 +0800
add .gitreview file by gerrit. #原始clone后的位置
硬回退到原始克隆时的位置
[sisi@pre-srv44 test_project1]$ git reset --hard 698c
HEAD is now at 698ca36 add .gitreview file by gerrit.
重新改,重新提交
[sisi@pre-srv44 test_project1]$ vi .gitreview
[gerrit]
host=172.16.181.80
port=29418
project=test_project1.git
[sisi@pre-srv44 test_project1]$ git add .gitreview
[sisi@pre-srv44 test_project1]$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: .gitreview
[sisi@pre-srv44 test_project1]$ git commit -m 'mod .gitreview'
[master e9a04cf] mod .gitreview
1 file changed, 1 insertion(+), 1 deletion(-)
[sisi@pre-srv44 test_project1]$ git review
remote: Processing changes: new: 1, refs: 1, done
remote:
remote: New Changes:
remote: http://172.16.181.80:8080/1 mod .gitreview
remote:
To ssh://172.16.181.80:29418/test_project1.git
* [new branch] HEAD -> refs/publish/master
这次提交成功,push到gerrit的refs/publish/master这个分支
进入gerrit进行code_review, gerrit2和sisi各+1,code_review得分是2,通过
但是verfied 无法+1,这个一般是由自动程序实现的,如jenkins
现在显示 Change 1 - Needs Verified Label
如何去掉Verified Label
方案1 改数据库(失败)
ssh-gerrit gerrit gsql
DELETE FROM approval_categories WHERE category_id = 'VRIF';
DELETE FROM approval_category_values WHERE category_id = 'VRIF';
找不到这两个表
https://stackoverflow.com/questions/7271208/gerrit-remove-need-verified-1-verified
方案2 参照安装verfied label 反向操作(成功)
https://www.cnblogs.com/kevingrace/p/5651447.html
[gerrit2@pre-srv44 .ssh]$ ls
admin admin.pub config gerritadmin gerritadmin.pub id_rsa known_hosts
[gerrit2@pre-srv44 .ssh]$ cp gerritadmin id_rsa #因为gerrit2用的是这私钥对应的公钥,改成默认名才能找到
[gerrit2@pre-srv44 .ssh]$ cd ~/devwork/cfg/
[gerrit2@pre-srv44 cfg]$ ls
[gerrit2@pre-srv44 cfg]$ git pull origin refs/meta/config
remote: Counting objects: 16, done
remote: Finding sources: 100% (16/16)
remote: Total 16 (delta 0), reused 1 (delta 0)
Unpacking objects: 100% (16/16), done.
From ssh://172.16.181.80:29418/All-Projects
* branch refs/meta/config -> FETCH_HEAD
[gerrit2@pre-srv44 cfg]$ vi project.config
删除[label "Verified"]及以下共7行
[gerrit2@pre-srv44 cfg]$ git add project.config
[gerrit2@pre-srv44 cfg]$ git commit -m 'del verified'
[master 2b01dc5] del verified
1 file changed, 7 deletions(-)
[gerrit2@pre-srv44 cfg]$ git push origin HEAD:refs/meta/config
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 301 bytes | 301.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 1, done
To ssh://172.16.181.80:29418/All-Projects
36265fa..2b01dc5 HEAD -> refs/meta/config
提交成功
然后重启gerrit
[gerrit2@pre-srv44 bin]$ ./gerrit.sh restart
Stopping Gerrit Code Review: OK
Starting Gerrit Code Review: OK
再登录gerrit查看,已经没有verified label了
点击summit,则此变更被merge到gerrit项目的主分支中了。
查看merge到gerrit的变更是否同步到gitlab
登录gitlab下,查看同名的项目,发现已经多了一个提交,这是通过gerrit的replication同步过来的。
可以查看replication的日志,在gerrit安装目录下logs\replication.log中。
gerrit配置和使用的更多相关文章
- Gerrit配置--用户配置
环境: Gerrit Server:172.16.206.133 Client:172.16.206.129 1.在Gerrit服务器上创建用户 Gerrit服务器使用的是HTTP认证类型,并用htt ...
- gerrit 配置 apache2 反向代理(转载)
Apache 2 Configuration To run Gerrit behind an Apache server using mod_proxy, enable the necessary A ...
- Gerrit 配置同步到多个仓库
1.修改replication.config文件 [remote "xxx"] projects = Yilule.Core.Service #aliyun仓库 url = git ...
- gerrit配置跳过审核直接push到gitlab
项目中有存放项目相关的文档,这些项目需要配置跳过审核再提交的操作.现在需要给某些组配置不审核直接提交的权限 方法: 使用管理员账号,到 projects -> access 页面下配置 refe ...
- Gerrit安装配置
环境: CentOS 1611 + gerrit-2.11.4 (review.openstack.org) 1. 安装java1.8 (>1.7) [root@review ~]# yum i ...
- Gerrit+apache+H2数据库简单安装配置及建库流程
Gerrit 是一个基于 Web 的代码评审和项目管理的工具,面向基于 Git 版本控制系统的项目.因此需要Apache.Mysql.GIT等相关软件的支持 系统配置: 新装的UBANTU LINUX ...
- [原创]CI持续集成系统环境--Gitlab+Gerrit+Jenkins完整对接
近年来,由于开源项目.社区的活跃热度大增,进而引来持续集成(CI)系统的诞生,也越发的听到更多的人在说协同开发.敏捷开发.迭代开发.持续集成和单元测试这些拉风的术语.然而,大都是仅仅听到在说而已,国内 ...
- gerrit 使用笔记
添加git hooks git库的钩子目录中有一个commit-msg脚本文件,可以在git执行commit时,在提交信息中自动添加一个唯一的Change-Id scp -P 29419 admin@ ...
- Gerrit系统框架介绍
Gerrit目录介绍 转自:https://blog.csdn.net/tanshizhen119/article/details/79889242 先上图 bin/ : 主要是放gerrit.sh启 ...
随机推荐
- parson json解析
最近交互数据中用到JSON数据,很多年以前用过CJSON解析和生成JSON数据,貌似CJSON已经发展成为了libjson,本打算用libjson库,不过其提供的解析JSON方式采用了回调,是测试过程 ...
- Readability Assessment for Text Simplification -paper
https://pdfs.semanticscholar.org/e43a/3c3c032cf3c70875c4193f8f8818531857b2.pdf 1.introduction在Brazil ...
- 【BZOJ3514】 Codechef MARCH14 GERALD07加强版
hentai... 原题: N个点M条边的无向图,询问保留图中编号在[l,r]的边的时候图中的联通块个数. 对于100%的数据,1≤N.M.K≤200,000. 直接复制wulala的题解 wulal ...
- LG4238 【【模板】多项式求逆】
前言 学习了Great_Influence的递推实现,我给大家说一下多项式求逆严格的边界条件,因为我发现改动一些很小的边界条件都会使程序出错.怎么办,背代码吗?背代码是不可能,这辈子都不会背代码的.理 ...
- imrersize函数
imrersize函数: 用法:imresize(图像I,method,倍数) 'nearest'(默认值)最近邻插值'bilinear'双线性插值'bicubic'双三次插值 使用方法: clear ...
- 100 webhook implementations
转自: https://streamdata.io/blog/100-webhook-implementations/ 很不错的整理 What is the scope of the event-d ...
- EXtJS Ext.data.Model
(一).首先我们介绍一下Model类中比较常用的几个属性,如果我们想构建一个Model类,最主要的属性就是(Fields)属性,这个属性接受一个数组.用来设置Model中所包含的字段.定义的格式如下: ...
- redis服务以及phpredis扩展的安装
一.下载软件包 下载redis wget http://download.redis.io/releases/redis-3.0.7.tar.gz 下载redis的php扩展 wget http:// ...
- Spring技术内幕总结 - IoC容器的实现
IoC:Inversion of Control,控制反转,即依赖对象的获得被反转了(DI:dependency inversion,依赖注入)在Spring中,IoC容器是实现这个模式的载体.它可以 ...
- Linux 命令之删除命令
在Linux下删除文件用rm命令,具体用法如下: rm [选项] 文件 选项说明: -f -force 忽略不存在的文件,强制删除,无任何提示 -i --interactive 进行交互式地删除 -r ...