Gerrit 服务器入门使用-项目的创建与克隆

                                     作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

一.创建克隆项目

1>.点击"BROWSE"

2>.点击"CREATE NEW"

3>.项目创建成功

二.基于HTTP方式克隆项目

1>.克隆项目

[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total
drwxrwxr-x gerrit gerrit Jun : soft
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ git clone "http://172.30.1.201:8080/yinzhengjie-code"
Cloning into 'yinzhengjie-code'...
remote: Counting objects: , done
remote: Finding sources: % (/)
remote: Total (delta ), reused (delta )
Unpacking objects: % (/), done.
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total
drwxrwxr-x gerrit gerrit Jun : soft
drwxrwxr-x gerrit gerrit Jun : yinzhengjie-code
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$ ll yinzhengjie-code/
total
[gerrit@node201.yinzhengjie.org.cn ~]$
[gerrit@node201.yinzhengjie.org.cn ~]$

2>.查看Gerrit的用户名

3>.在git上配置和Gerrit上存在的用户名和邮箱(要进入到已经克隆的项目中)

[gerrit@node201.yinzhengjie.org.cn ~]$ ll
total
drwxrwxr-x gerrit gerrit Jun : soft
drwxrwxr-x gerrit gerrit Jun : yinzhengjie-code
[gerrit@node201.yinzhengjie.org.cn ~]$ cd yinzhengjie-code/
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$ git config user.name "jason"
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$ git config user.email "y1053419035@qq.com"
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$

4>.下载commit-msg

[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$ curl -Lo .git/hooks/commit-msg http://172.30.1.201:8080/tools/hooks/commit-msg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
2119k --:--:-- --:--:-- --:--:-- 2334k
[gerrit@node201.yinzhengjie.org.cn ~/yinzhengjie-code]$

三.通过ssh方式克隆项目

1>.创建密钥

[root@node203.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:jjm9d783Ac7qfftXmgCPRmI6fJ/5yf74YHZSi4ofw7I root@node203.yinzhengjie.org.cn
The key's randomart image is:
+---[RSA ]----+
| |
| |
| |
| o o . |
| . oSo +o o |
| +=..o o= o.|
| +o+o+oB.ooo|
| . ==Oo*ooo|
| Eo+=*=*+*|
+----[SHA256]-----+
[root@node203.yinzhengjie.org.cn ~]#

2>.点击设置

3>.点击“SSH Keys”

4>.点击"SSH keys",将公钥拷贝到Gerrit上后点击"ADD NEW SSH KEY"

5>.公钥添加成功

6>.查看ssh的克隆命令

7>.使用ssh的方式克隆代码

[root@node203.yinzhengjie.org.cn ~]# ll
total
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# git clone "ssh://jason@node201.yinzhengjie.org.cn:29418/yinzhengjie-code"
Cloning into 'yinzhengjie-code'...
The authenticity of host '[node201.yinzhengjie.org.cn]:29418 ([172.30.1.201]:29418)' can't be established.
ECDSA key fingerprint is SHA256:Mx8JcnxxxM/b99YiBG6+S8JP8Q12GNFYz0g/+YO4c0.
ECDSA key fingerprint is MD5:c0:2a:ae::::7b:fb::b3:e8:a5:d9:::6a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[node201.yinzhengjie.org.cn]:29418,[172.30.1.201]:29418' (ECDSA) to the list of known hosts.
remote: Counting objects: , done
remote: Finding sources: % (/)
remote: Total (delta ), reused (delta )
Receiving objects: % (/), done.
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# ll
total
drwxr-xr-x root root Jun : yinzhengjie-code
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]# ll yinzhengjie-code/
total
[root@node203.yinzhengjie.org.cn ~]#
[root@node203.yinzhengjie.org.cn ~]#

8>.使用另一种方式进行克隆

[root@node203.yinzhengjie.org.cn ~]# ssh -p  jason@172.30.1.201

  ****    Welcome to Gerrit Code Review    ****

  Hi jason, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
To clone a hosted Git repository, use: git clone ssh://jason@node201.yinzhengjie.org.cn:29418/REPOSITORY_NAME.git        #我们根据提示,这种克隆方式也是ok的 Connection to 172.30.1.201 closed.
[root@node203.yinzhengjie.org.cn ~]#

最新文章

  1. SharePoint 2010 数据库xxx的事务日志已满
  2. ng-switch
  3. nodeType、nodeName和nodeValue
  4. .frame类库简单介绍与使用
  5. C++开源大全
  6. springmvc学习笔记--支持文件上传和阿里云OSS API简介
  7. JVM垃圾收集策略解析
  8. centos 下 yum安装和卸载软件
  9. php中对共享内存,消息队列的操作
  10. oracle dblink使用
  11. JAVA存取对象属性时,如果开程多线程,记得对相关存取方法作原子化操作定义
  12. iOS:编译错误Undefined symbols for architecture i386: _OBJC_CLASS_$_XXX", referenced from: error
  13. html超级简单实现点赞(收藏)和取消赞效果
  14. Graph图总结
  15. oracle的存储过程的作用
  16. 尚硅谷springboot学习30-docker安装mysql示例
  17. 直播协议的选择:RTMP vs. HLS
  18. sublime3 快速创建html模板
  19. Java遍历集合的几种方法分析(实现原理、算法性能、适用场合)
  20. vue的watcher 关于数组和对象

热门文章

  1. maven安装和应用
  2. C语言设计模式
  3. hive 字符串截取
  4. 研发的困境----DEVOPS
  5. python中空列表判断方法总结,欢迎补充
  6. 我瞅瞅源码系列之---flask
  7. Hive drop table,create table没有反应处理方法
  8. ZYNQ笔记(1):PL端——led灯
  9. Python入门 .变量 常量 基础数据类型 用户输入 流程控制语句 小练习题
  10. Oracle打印输出在控制台